MongoDB Java pull -
i tried remove embedded document without succcess. i'm looking java way of following instruction:
db.games.update({'_id': 73}, {$pull: {'goals': {'goal': 4}}})
the java documentation pretty clear, constructing bson objects match respective json counterparts used in shell:
basicdbobject query = new basicdbobject("_id", 73); basicdbobject fields = new basicdbobject("goals", new basicdbobject( "goal", 4)); basicdbobject update = new basicdbobject("$pull",fields); games.update( query, update );
Comments
Post a Comment