0
如何獲得MongoDB文檔「test」:來自RockMongo和PHP的NumberInt(1000)屬性?MongoDB:如何在特定的對象結構深處獲取文檔?
我想的東西都到{ 「項目」:{ 「測試」:1000}},但
沒有記錄被發現。蒙戈集合
樣品:
{
"_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)
},
}
}
在你的樣品''項目''是對象。可能是數組? –
根據您所顯示的結構,沒有可用的查詢。看起來你並沒有將'items'保存爲一個數組。如果這是故意的,那麼查詢將不起作用,因爲子文檔的字段名稱未知。你應該看到''項目「:[{」test「:NumberInt(1000)}]'。 – WiredPrairie