MongoDB C驱动程序如何在对象数组中查找对象字段值

时间:2016-06-27 08:58:02

标签: mongodb mongo-c-driver

我试图在C驱动程序中寻找类似于以下内容的方法: https://docs.mongodb.com/manual/reference/operator/query/elemMatch/#op._S_elemMatch

在这个帖子中回答:
Query for a field in an object in array with Mongo?

我有这个json,我想检查sessions.id = 1234556的值:

{
    "_id": ObjectId("5768e43"),
    "APPID": {
        "Number": 0,

    },
    sessions: [
        {
            id:1234556,
            "setOID": {
                "Number": 0 

            },
            "custID": {
                "Number": 0 

            },

        },
        {
            id:133333,
            "setOID": {
                "Number": 2 

            },
            "custID": {
                "Number": 2 

            },

        },
     ]
}

如何在新的C驱动程序中完成?

0 个答案:

没有答案