MongoDB的代碼這是原來的代碼我想:如何寫在delphi
obj = {
sentence: "this is a sentece",
tags: [ "some", "indexing", "words"]
}
和
findOne({tags: "words"}).name);
我用TMongWire如MongoDB中的包裝德爾福 和我寫這個:
//var
// d:IBSONDocument;
d:=BSON([
'id',mongoObjectID,
'sentence', 'this is a sentece',
'tags','["some", "indexing", "words"]'
]);
FMongoWire.Insert(theCollection,d);
它似乎是c上述頌歌做的工作
但是當我用「標籤」查詢,它似乎不適合我
//var
//q:TMongoWireQuery;
//qb:IBSONDocument
qb:=BSON(['tags', '"words"']); //***
q:=TMongoWireQuery.Create(FMongoWire);
q.Query(mwx2Collection, qb); //***
我如何寫兩行*星號?
我會嘗試通過本地德爾福'Array'類型。如果這不起作用,你總是可以在github上發佈一個[TMongoWire問題](https://github.com/stijnsanders/TMongoWire/issues),並希望原作者將回應/記錄需要什麼。 – Stennie 2012-07-09 00:40:44
VarArrayOf()而不是BSONArray()....我離確定的答案並不遙遠! :) OleVariant有點費時,並且依賴於平臺......原生Delphi數組可能更有意義。 – 2012-07-09 06:20:41