如何在收藏夹中搜索文档?

时间:2019-02-11 01:03:05

标签: node.js mongodb

如何使用Node.js在集合中搜索文档?

我正在这样做:

db.collection("popchat").findOne({'start'} ,function (err, result) {
    if (err) throw err;
    console.log(result);
    db.close();
});

但是它不起作用。这是我的收藏集的样子:

"_id" : ObjectId("5c272883e7179a7487992cb1"),
"start" : {
    "msg" : {
        "text" : "ready? here we go"
    },
    "jump" : "ask"
},
"ask" : {
    "msg" : {
        "text" : "Whos your favorite politician?",
        "quick_replies" : [
            {
                "content_type" : "text",
                "title" : "Bibi",
                "payload" : "ASK_BIBI"
            },
            {
                "content_type" : "text",
                "title" : "Sara",
                "payload" : "ASK_SARA"
            },
            {
                "content_type" : "text",
                "title" : "Ehud Barak",
                "payload" : "ASK_BARAK"
            }
        ]
    }
},

0 个答案:

没有答案