I’ve got a MongoDB collection that looks something like this:
[
{
"title": "Entry 1",
"visible": true
},
{
"title": "Entry 2",
"visible": true
}
]
I want to find the entry whose title matches my query (say, array("title" => "Entry 1")), and change its visible property.
This seems so incredibly simple, but I haven’t found any way to do it. I see how to return the entry I want as an array. It seems to me I shouldn’t have to fetch the entire object (which has many more properties than this example), change one small thing, then put the entire object again. What am I missing?
Read about positional operator