Couchbase lite 2.0: how to query with an n1ql string

query

#1

Hi, I’m using couchbase lite 2.0 for android, and I would like to query the database with n1ql queries as text, similar to what the java SDK permits mee to do:
N1qlQuery query = N1qlQuery.simple(statement);

At the moment I don’t see that possibility. Am I missing something or is this on the roadmap?


#2

That’s not supported. Both because it would require reimplementing the N1QL parser, and to make the product more supportable — because the type-checked API eliminates lots of N1QL syntax errors and other mistakes (which often result in support tickets from customers.)


Public interface for N1QL string queries
#3

I understand, I’ve written a cordova plugin to use the new couchbase lite 2.0, so this will limit the queries we can do with it…


#4

Under the hood, CBL generates the query in a JSON format and passes that to our query engine. It would be pretty ideal for a JavaScript API to just use that format; unfortunately CBL has no public API to create a Query object directly from JSON.


#5

unfortunately CBL has no public API to create a Query object directly from JSON

Are there any plans to support that? It would be really useful for react native plugin I’m working on.


#6

I’ll bring this to the attention of our project manager @priya.rajagopal :slight_smile:


#7

@jens This would be really helpful. The only feature currently missing in React Native Couchbase Lite 2 plugin is queries.