I have stuck in a situation which working on MongoDB.
Below is the structure of my mongoDB :
<pre>
{
"_id" : ObjectId("53565ae90edaafbe4a7f890b"),
"email" : "[email protected]",
"fname" : "abc",
"lname" : "cde",
"Password" : "sadasdsadasdasdasdaasasdas",
"Start Date" : "Start Date",
"Inactive Date" : "Inactive date",
"DOB" : "Date of Birth",
"Address" : {
"Line1" : "Line1",
"Line2" : "Line2",
"city" : "City",
"State" : "Delhi"
},
"newsfeed" : [
{
"post_id" : ObjectId("535671910edaafbe4a7f8918"),
"post_by" : ObjectId("53565bb00edaafbe4a7f890d"),
"Post_content" : "content of the post",
"likes" : [ ],
"comments" : [ ]
},
{
"post_id" : ObjectId("535671920edaafbe4a7f8919"),
"post_by" : ObjectId("53565bb00edaafbe4a7f890d"),
"Post_content" : "content of the post",
"likes" : [ ],
"comments" : [ ]
}
]
}
</pre>
While practicing, i was trying to emulate the data model for a social networking site such as facebook. Now i wanted to update the likes array where post ID is ObjectId("535671920edaafbe4a7f8919"). How can i do this without using any scripting language and straight from mongoshell by update statement.
Query parameter in update statement does not seems to work and it does not locate the exact position of ObjectId("535671920edaafbe4a7f8919").
any help will be appreciated.