Suresh Lakku
Suresh Lakku

Reputation: 95

Couchbase view on multiple columns with WHERE and ORDER BY clause as in SQL

I am new to Couchbase noSql database.

I am trying to create a view, i want this view should give result as below SQL query.

SELECT * FROM Employee e WHERE e.name = "DESM%" AND e.salary < 1000 ORDER BY e.id desc

Any suggestion is very appreciated.

Upvotes: 2

Views: 640

Answers (1)

user1697575
user1697575

Reputation: 2848

If you look at existing beer samples in Couchbase (it comes with it), you will find views defined there. In admin console you can run a view. Notice when you run a view you can provide filtering criteria and sort order for the result...that might be an equivalent for your SQL like functionality. Read more on Views and Indexes

yet another option is to use Couchbase v3 that comes with its own N1QL query language that can serve as another alternative. You can try it out online here.

Upvotes: 1

Related Questions