In 2.6, a new kind of operation appeared that caused massive operations . It reminds me of transactions - the user can specify a set of records and subsequently execute them as described below
var bulk = db.users.initializeOrderedBulkOp(); bulk.insert( { user: "abc123", status: "A", points: 0 } ); bulk.insert( { user: "ijk123", status: "A", points: 0 } ); bulk.insert( { user: "mop123", status: "P", points: 0 } ); bulk.find( { status: "D" } ).remove(); bulk.find( { status: "P" } ).update( { $set: { comment: "Pending" } } ); bulk.execute();
Is bulk operation atomic? Is a potential consumer reading non-repeating or phantom?
mongodb
madcyree
source share