Push opeartion failed if $push and $upsert for same document were built into same BulkOperation execution

51 views
Skip to first unread message

gabriel wang

unread,
Jan 19, 2016, 5:05:00 PM1/19/16
to mongodb-user

Two separated operation: $push and $upsert were built in same BulkOperation. if two operations perform on different field of same document, it will cause the $push operation failed.

This issue occurs only when very heavy writing operation on a collection, and about 1/1000 $push operation failed, and the majority $push operation is correct.


BulkOperationBuilder p_bulk = db_conn_.initializeOrderedBulkOp(db_collection_ns_);

p_builder.find(queryObj).upsert().updateOne(BSON("$set"<<bsonObj_1));
p_builder.find(queryObj).update(BSON("$push"<<bsonObj_2));

try

{

  p_builder.execute()

}

catch(const DBException& eobj)

{
  ..........

}


If both query hit same document, the push operation didn't create the array correctly. If move push operation away from bulkOperationBuilder and run it in the non-bulk mode, the array field was created correctly. Moreover, even push operation failed in the bulkOpeation mode, there is no exception raised for the bulkOperation.execute().


[Environment]

1) mongo-cxx-driver legacy v1.0.1

2) Mongodb 3.0.5 + wiredTiger

3) CentOS 7

4) In terms of the order of $push and $set for a given document, the $push is the final operation on a given document. It's impossible that a $push happen before a $set for a specific document.


Thanks for your help in advance.

Asya Kamsky

unread,
Jan 19, 2016, 10:18:38 PM1/19/16
to mongodb-user
It would help if you could include the mongod docs for one of these failed sequences of operations.

At the very least, we need to know what "didn't create the array correctly" means.

Asya


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/a0321678-a040-40fb-9c37-a94a8a05052d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Asya Kamsky
Lead Product Manager
MongoDB
Download MongoDB - mongodb.org/downloads
Free MongoDB Monitoring - cloud.mongodb.com
Free Online Education - university.mongodb.com
Get Involved - mongodb.org/community
We're Hiring! - https://www.mongodb.com/careers
Reply all
Reply to author
Forward
0 new messages