用PHP访问MongoDB嵌入式文档数组

时间:2018-02-21 10:20:30

标签: arrays mongodb

您好我试图在此阵列中找到嵌入式文档:

"_id" : 0,
    "name" : "Sykes",
    "orders" : [
                {
                    "invoiceNumber" : 788,
                    "cart" : [
                            {
                                    "item" : 0,
                                    "pkgId" : 3,
                                    "qty" : 10
                            }
                    ]
                },
                {
                    "invoiceNumber" : 801,
                    "cart" : [
                            {
                                    "item" : 1,
                                    "pkgId" : 1,
                                    "qty" : 8
                            }
                    ]
                }

我试过这个:

db.customer.find({_id:1},{'orders.invoiceNumber':1,_id:0}).pretty()

我需要将此命令转换为PHP。有什么帮助吗?

0 个答案:

没有答案
相关问题