Help required regarding conditional query in Couchbase through JAVA SDK

There are three ways to model this:

  • You can use a view which indexes your document in a way such as (they key): [status, type, createdDate] … now on query time you query for a range where the end range is [“active”, “type”, “yourdateformat”], for example a unix timestamp or some other format…
  • If you are developing right now you can start using N1QL, which might make it more easy since your oracle queries can be very easily transferred over to N1QL
  • Use key/value only and maintain a separate document which contains primary keys of all documents that satisfy your criteria.

Each of those approaches has its own pros and cons, but the view approach will be pretty solid I think. If you are starting on development and you plan a larger oracle migration, going with N1QL might pay off as well.