I have 20,000+ documents in my mongodb. I just learnt that you cannot query them all in one go.
So my question is this:
I want to get my document using find(query)
then limit its results for 3 documents only and I can choose where those documents start from.
For example if my find()
query resulted in 8 documents :
[{doc1}, {doc2}, {doc3}, {doc4}, {doc5}, {doc6}, {doc7}, {doc 8}]
command limit(2, 3)
will gives [doc3, doc4, doc5]
And I also need to get total count for all that result(without limit) for example : length()
will give 8
(the number of total document resulted from find()
function)
Any suggestion? Thanks
add .skip(2).limit(3)
to the end of your query
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With