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

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -