You are not logged in.
Pages: 1
Hello there.
I would like to write the following query exactly.
db.inventory.distinct( "sizes" )
But I couldn't find how to write this in Mormot.
https://docs.mongodb.com/manual/referen … thod-array
I tried the following methods and the like but failed.
Can you help me please.
var DB: TMongoDatabase;
vDocData: TDocVariantData;
begin
DB := MongoCli.Open('core');
DB.RunCommand('getCollection(''inventory'').distinct( "Sizes" )', retVal);
DB.RunCommand('inventory.distinct( "Sizes" )', retVal);
vDocData.InitJSON(VariantToUTF8(DB.Collection['inventory'].FindDoc('distinct( "Sizes" )', [])));
// Server.Retrieve('inventory.distinct( "Sizes" )')
end;
Offline
You need to use a pipeline.
Check how the MongoDB client implements the distinct() JavaScript function.
inventory.distinct() is a MongoDB client-only function: the MongoDB server only knows pipelines.
Offline
Pages: 1