一种在MongoDB数组中保存嵌套位置的方法

时间:2017-10-15 12:26:47

标签: mongodb mongoose

我在数据库中创建了带有值索引位置卡的变量。

问题在于这里有$ set,有人可以使用变量“position”来查询我吗???

我们可以创建这样的查询吗?

enter image description here

因为此时此查询不起作用。有人能帮帮我吗?

修改

/* 1 */
{
    "_id" : ObjectId("59e0aa31daa273086bf100ae"),
    "name" : "2",
    "users" : [ 
        ObjectId("59cd114cea98d9326ca1c421")
    ],
    "lists" : [ 
        {
            "list" : "1",
            "cards" : [ 
                {
                    "name" : "dea"
                }
            ]
        }, 
        {
            "list" : "dea",
            "cards" : [ 
                {
                    "name" : "22222",
                    "Author" : [ 
                        "59df60fb6fad6224f4f9f22d", 
                        "59df60fb6fad6224f4f9f22d", 
                        "59df60fb6fad6224f4f9f22e"
                    ]
                }, 
                {
                    "name" : "fea"
                }
            ]
        }
    ],
    "__v" : 0
}

/* 2 */
{
    "_id" : ObjectId("59e35de8a8c83d1ab00dfcb9"),
    "name" : "2",
    "users" : [ 
        ObjectId("59cd114cea98d9326ca1c421")
    ],
    "lists" : [],
    "__v" : 0
}

0 个答案:

没有答案