Closed scaleman114 closed 7 years ago
If I read this correctly, $and
takes an array. And in the mean time I've changed TMongoWire to use jsonDoc so it's JSON
instead of BSON
now. It has a different syntax to embed documents. I'm not sure 'customer.custNo'
as a key will work, so I've split that here also:
d:=JSON(['$and',VarArrayOf([JSON(['customer{','custNo',4000,'}']),JSON(['allocated',true])]);
Let me know if this works for you.
Thanks again! I am still using BSON as I am trialling Rice.Mongo framework, so this works for me: d:=BSON(['$and',VarArrayOf([BSON(['customer.custNo',4297]),BSON(['allocated',false])])]);
And it works with the 'customer.custNo'
key? Great, good to know.
Hi, I wonder if you could possibly provide me an example of using the $and operator in a query? I am looking for something like: d := BSON(['customer.custNo',4000,$and[BSON(['allocated',TRUE]))]) Tried a few ways but just can't get it to work. Thanks for all your previous help.