Answer the question
In order to leave comments, you need to log in
How to get the range of elements of a mongodb collection?
The database contains something like this
[
{'job': 'Ecologist', 'company': 'Eaton-Romero'}
{'job': 'Environmental education officer', 'company': 'Roman-Lee'}
{'job': 'Water quality scientist', 'company': 'Gillespie Inc'}
{'job': 'Technical author', 'company': 'Clark Group'}
{'job': 'Physiological scientist', 'company': 'Smith, Nguyen and Matthews'}
{'job': 'Colour technologist', 'company': 'Robinson PLC'}
{'job': 'Radio producer', 'company': 'Coleman, Reyes and Austin'}
{'job': 'Designer, graphic', 'company': 'Thomas Inc'}
{'job': 'Engineer, broadcasting (operations)', 'company': 'Le Ltd'}
]
db.collection.find(
<query>,
{ <arrayField>: { $slice: <number> } }
);
db.collection.find({}, { <arrayField>: { $slice: [start, end] })
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question