Answer the question
In order to leave comments, you need to log in
Receive N number of documents by condition?
There are several documents with a value field of type:
id: 2249191
value: 20
admin: false,
id: 224914191
value: 50
admin: true,
id: 2249191
value
: 35
admin: false
there are 50 - 35 - 20 and is it possible?
Answer the question
In order to leave comments, you need to log in
MongoDB provides the ability to sort a dataset retrieved from the database using the sort function. By passing the values 1 or -1 to this function, we can specify in which order to sort: ascending (1) or descending (-1). In many ways, this function is similar in action to the ORDER BY clause in SQL. For example, sorting in ascending order on the name field:
https://metanit.com/nosql/mongodb/2.4.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question