我正在使用d語言進行編碼,並試圖提取最後一個從文檔的陣列修改的文檔,與d語言(在控制檯不!!!!) 該查詢是這樣的:我如何在d-languge中找到mongodb集合中的最後一個修改數據,並用find({「...」:「..」})進行篩選
Collection ct = mongo.web.cell;
auto cell = ct.find({"room": 4 }).sort({'_id': -1 }).limit(1);
和通過配音給出的誤差是
source/app.d(166,58): Error: found : when expecting ; following statement
source/app.d(166,61): Error: found } when expecting ; following statement
source/app.d(166,62): Error: found) instead of statement
當更改到達單元格數據插入的房間,未更新 我正在使用Visual Studio代碼,最新版本
有什麼想法?
'{「房間」:4}'是沒有有效的語法,如果你想通過你需要使用'關聯數組[「房間」:4]' – weltensturm
THKS但沒't不是工作,而是得到這些錯誤,而不是: source/app.d(170,54):錯誤:未終止的字符常量 source/app.d(170,56):錯誤:在期望時發現ID;以下語句 source/app.d(170,58):錯誤:未終止的字符常量 source/app.d(170,60):Error:found:when expected;以下語句 source/app.d(170,63):Error:found} when expected;下面的語句 source/app.d(170,64):Error:found)而不是語句 –
而且如果我將行簡化爲find([「room」:4]);我得到這個錯誤mondo.Collection.find(T = BsonObject)(在查詢query = Query.init中,在QueryFlags標誌= QueryFlags.NONE中,在ReadPrefs readPrefs = null中) –