![](/img/trans.png)
[英]How to get a object value nested inside document in a collection in MongoDB PHP
[英]MongoDB: how to get document with specific propety deep inside the object structure?
如何从RockMongo和PHP获得带有“ test”:NumberInt(1000)属性的MongoDB文档?
我尝试了类似的方法来{{items“:{” test“:1000}} ,但是
找不到记录。
Mongo收集样本:
{
"_id": ObjectId("xxx"),
"items": {
"0": {
"0": {
"test": NumberInt(1000)
}
},
"1": {
"test": NumberInt(2000)
},
},
},
{
"_id": ObjectId("yyy"),
"items": {
"0": {
"0": {
"test": NumberInt(3000)
}
},
"1": {
"test": NumberInt(4000)
},
}
}
尝试这个
db.coll.find( { 'items.test': 1000 } )
并确保items
是一个array
而不是一个object
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.