Is it possible to sort the filter of an update command on MongoDb

Viewed 25

I'm migrating a Queue System based on MongDb/C# that I already had in other SQL Databases.

The SQL command that I would like to have something similar is:

UPDATE Orders
SET IsProcessig = true, WorkerName="Worker"
WHERE IsProcessing = false
ORDER BY ProcessingDate

In the orders table, I may have hundreds or thousands of records and to mark the one that will be processed by the worker, he flags the older Order with the worker's name.

In SQL Databases this query works fine, but I can't find a way to do a sorted-list-update in MongoDb.

1 Answers

According with @rickhg12hs I use aggregation to be able to have the same behavior

Related