0

How do I query for ranges using reactivemongo. Something equivalent to

 db.collection.find( { field: { $gt: value1, $lt: value2 } } );

Thanks.

user203617
  • 523
  • 8
  • 20

1 Answers1

0

Just doing this quickly and off memory but something like:

val query = BSONDocument(
  "field" -> BSONDocument(
    "$gt" -> value1)
    .add( BSONDocument(
        "$lt" -> value2 )
    )
)

I'm sure there is a more elegant way to use JSON with play though.

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317