mercredi 14 mai 2014

Consecutive updates in MongoDB (Java)


Vote count:

0




Using the update() method, it seems that only the first one does anything. If I switch them around same thing happens, only first update commits.



BasicDBObject update = new BasicDBObject();
update.append("$push", new BasicDBObject().append("questions", <question>));
col.update(doc, update);

BasicDBObject update2 = new BasicDBObject();
update2.append("$push", new BasicDBObject().append("answers", <answer>));
coll.update(doc, update);


Is there any way to update the same document twice (order doesn't matter)?



asked 14 secs ago






Aucun commentaire:

Enregistrer un commentaire