#1 2016-05-15 13:38:21

kattunga
Member
Registered: 2016-05-15
Posts: 1

Write MongoDb shell command

Hello,

I wrote an application that has a TMemo where the user can directly write a find command to execute over a collection.
But I want to let the user write the command in the same way you write in mongo shell.

db.orders.find("item.category": 10).sort( { "item.category": 1, "item.type": 1 } ).limit(10) 

Can I do this using SynMongoDB?

I can't use TMongoCollection.FindDoc because in MongoDb 3.2 the sort only can be applied to a cursor.

Best regards

Offline

#2 2016-05-15 14:36:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,239
Website

Re: Write MongoDb shell command

Use the aggregate methods, i.e. TMongoCollection.AggregateDoc() and other associated methods.

Online

Board footer

Powered by FluxBB