I've got a collection of content. Said collection has a collection of responses as such
Content : [{ 'id' : '1234',
'Responses' : [{
'id' : '12345'
}
etc. Now, I want to remove response 12345, but I don't want to remove all of the responses. I can't seem to find the command to do so. I'm getting the impression that the correct action is to grab the object, rebuild the Responses without the one I want removed, and then save the Content object as a whole. Provided there are many responses, this seems like a bad practice to have to load the entire object that way.
From stackoverflow
-
$pull
is what you are looking for. See for more in the documentation: http://www.mongodb.org/display/DOCS/Updating#Updating-%24pull
0 comments:
Post a Comment