how to find document in mongodb collection, if i have ObjectID as string?
how to find document in mongodb collection, if i have ObjectID as string?
i tried some variants, but without success
.Match('"_id" : ObjectId("57EB7FD37E58C0C489BFF6F2")')
and
.Match
.BeginObject('_id.$oid')
.Add('$eq', '57EB7FD37E58C0C489BFF6F2')
.EndObject
both does not work.....
i tried some variants, but without success
.Match('"_id" : ObjectId("57EB7FD37E58C0C489BFF6F2")')
and
.Match
.BeginObject('_id.$oid')
.Add('$eq', '57EB7FD37E58C0C489BFF6F2')
.EndObject
both does not work.....
/Sub
ReplyDeleteWow :)
ReplyDeleteI'm very happy to post a solution :)
FCon[DBName][CollectionName].CommandSimple(
'{ '+
' find: "MyCollection", '+
' filter: { _id : {"$oid":"57EB7FD37E58C0C489BFF6F2"} }, '+
'}'
).AsJSON;
now, i have to see, how to exclude only the part that i need.
or
ReplyDeleteFCon[DBName][MyCollection].Dereference(TJsonOid.Create('57EB7FD37E58C0C489BFF6F2'));
Both are ok,
first one better for complex querys on server side.