Ruby and N1QL Support

We are using ruby and looking to switch from view-based to n1ql and have some question:

  1. Is N1QL support in Ruby? Looking at it says ‘Perform N1QL query to the cluster. This API is experimental and subject to change in future.’

  2. A can query couchbase but how to do I set the consistency flag?
    I tried
    connection.query(query_limit, {:scan_consistency => 'request_plus'}}
    but it seems it did not have affect.

Any update on how to set the consistency in the ruby gem?

Hi @dipen_patel, with this patch, current master (and future 2.0 release) will support request_plus scan consistency as well as other query options.

Thanks for feedback

@avsej, This would be great. Do you know when it would be release?

I saw your updates to the SDK, and what to know if you can provide me more details?

  1. When will it be released?
  2. Minium ruby version?
  3. It seems the libcouchbase requirement is gone is that correct?


At this moment minimum version is MRI ruby 2.6. In couple of days there will be release with most features covered.

Yes, libcouchbase is not required, all dependencies included. I’m trying to prebuild binaries for MacOS X and some other platforms (Windows is not included yet). When installing from source, C, C++ compilers and OpenSSL headers are also required.

This is an example of Query API

Thanks one more question

Will it support N1QL Consistency flag?

Yes, it will. I will add example showing this case.

Thanks, that is the biggest factor we cannot move off view and looking at other solutions.

We will be to try it and provide feedback quickly

So I’ve added example for query with consistency. Currently we have two ways to do it:

  1. where the query engine will wait for all mutations that have to be indexed by the time it received new request
  1. More granular approach, where application knows which mutation has to be applied before the request must be executed:

This examples uses some features that are on master branch, but hadn’t been included into 3.0.0.alpha.1, so to try it, you have to install library from git.