Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 对象数组内的更新标志_Node.js_Mongodb - Fatal编程技术网

Node.js 对象数组内的更新标志

Node.js 对象数组内的更新标志,node.js,mongodb,Node.js,Mongodb,我收到了这份文件: { "_id" : ObjectId("540d881d475d68010693e340"), "notes" : [ { "owner" : null, "creation" : 1411641315424, "text" : "test rec", "action" : "0", "recipients" : [

我收到了这份文件:

{
    "_id" : ObjectId("540d881d475d68010693e340"),
    "notes" : [ 
        {
            "owner" : null,
            "creation" : 1411641315424,
            "text" : "test rec",
            "action" : "0",
            "recipients" : [ 
                {
                    "username" : "root",
                    "read" : false
                }, 
                {
                    "username" : "zivolof",
                    "read" : false
                }
            ]
        },
        {
            "owner" : null,
            "creation" : 1411641315424,
            "text" : "test rec",
            "action" : "0",
            "recipients" : [ 
                {
                    "username" : "root",
                    "read" : false
                }, 
                {
                    "username" : "zivolof",
                    "read" : false
                }
            ]
        }
    ]
}
我通过以下查询找到它:

{
    "_id": id, 
    "notes.recipients": {
         $elemMatch: {
            username: username, 
            read: false
        }
    }
}

然后我需要将整个文档的
read
标志更新为
true
。我该怎么办?

@FezVrasta新功能:坦斯克!所以目前还没有直接MongoDB查询的方法?