Couchbase Lite and N1QL queries

Hi all,

I’m working on my app to replace my SQLite database with Couchbase Lite, which will bring a much needed feature such as real-time synchronization.

However, I’m wondering what kind of queries I’ll be able to do on Couchbase Lite. Will I be able to run “complex” N1QL queries using features like UNNEST, JOIN and aggregation operators (AVG, SUM, COUNT, etc.)?
Also, is there a way to run raw N1QL queries?


We support joins and aggregation, but not UNNEST. Check the documentation for more details.

There is no N1QL parser in CBL. Queries are constructed programmatically.

1 Like

Additional info : The announcement includes links to several query related blogs. And of course the documentation

Which platform are on you ? If you are on swift, there is query playground available here for trying things out

1 Like

@priya.rajagopal I’m on Android and Objective-C, no Swift for the moment, but thank you very much for the links.

Should be quite straightforward to map between the languages - hopefully. That’s been the goal of the Query spec and the Query Builder should assist you with that.

1 Like

@priya.rajagopal I checked the documentation and, if I’m not mistaken, Query Builder is available on Couchbase Lite 2 only, apparently it’s not available on 1.4 or 1.5, right?

I plan to deploy Couchbase Mobile in 4-5 months, by then I suppose there will be a stable release of Couchbase Lite 2.

Correct . 2.0 only.

Yes. Thats the plan. We should go GA by then. We are feature complete now so its code hardening between now and GA.

Hi, I know this is closed! But what should be the alternative for UNNEST?

1 Like