Is there any way in which I can tell mongo to return documents till some length is reached. For e.g I have collection of audio file and in the collection as
audio : {
name: string;
length: long;
releaseDate: long
}
Can I query as return all audio in a list such that, it is sorted by release date and
200>= sum(length) >= 100 [sum of length of audio file in the list]
The easiest way to do this in Mongo is to have your client-side program manually iterate through a cursor, and stop when the condition is completed. Here’s an example using the mongo shell:
I hope this helps!