Subject: [mongodb-user] Re: limiting resultset with
mongo-scala-driver's find function



for sort I can use .sort(sortBy.getOrElse(null)), but am unable to do .limit(limitBy.getOrElse(null))

Hi Colin,

This is because the FindObservable for limit parameter is defined as integer.

Any suggestions on how to call limit function on FindObservable to allow user selecting unlimited find without duplicating code?

I’m not sure what you’re intending to do by wrapping find in findAll
However, with the given findAll method where limitBy is Option[Int] you can just specify:

collection.find().limit(limitBy.getOrElse(0))

Regards,
Wan.

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit
om/d/msgid/mongodb-user/4a9b061c-cf60-46cb-a55a-416402e921f7%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/mongodb-user/4a9b061c-cf60-46cb-a55a-416402e921f7%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.



Programming list archiving by: Enterprise Git Hosting