N1QL - Sync Gateway compatibility


#1

Hi, I noticed that N1QL will be officially released with the first official bundle of Couchbase Server 4.0
my question is, how can I filter the output of my N1QL queries or authorize N1QL statements using the role based access control used in sync gateway to filter data and manage authorization?


Sync Gateway compatibility with N1QL
#2

Hi @donadev, our mobile team will reply to your question here with their future plans.

Thanks,
Gerald


#3

Thank you so much! I’m looking forward to read your answers!


#4

@donadev: We don’t have N1QL support officially on the Couchbase Mobile roadmap. We do have a number of internal discussions on how exposing N1QL via REST could best be accomplished. Can you provide me some details about your specific use case?


#5

Hi, I think that my use case is pretty common.
I have a big enterprise application, with a lot of data associated. I’m developing this for mobile and web clients. At the moment the application is web-only and has a Sails.js layer that connects directly to a CouchBase Server bucket. To create/update/delete data I use native couchbase SDK for Node.js, and for queries and more complex updates I use N1QL. I have also a layer of security and user management that runs on top of these services.
How can migrate this environment to make it suitable for mobile purposes?
I noticed that CouchbaseLite and SyncGateway are very useful in this case, but I want to mantain the schema of the data in my application, but I also want pull/push replications.
The problems with this implementation are the following:

  1. I want to provide the same security layer for mobile, web and N1QL also.
  2. I want also perform some extra logic on server side when I create/update/delete an object. I can’t do this in SGW sync function because I want to alter properties of other objects once one is created/updated/deleted
  3. I want to make the architecture the simplest and the more scalable possible.
  4. As I said, I want to make the data schema fixed. At the moment for this purpose I use the data validation layer provided by Sails.js

#6

I have the same requirements, and for 2, I also need the transaction mechanism for SGW.


#7

Can you describe what you’re hoping to get with transactions @atom_yang ? Changing multiple docs atomically? Prevention of phantom reads? It can mean a number of things and it’d be useful to know specifically what you’re looking for.


#8

what i means is that I create 2 docs,such as doc1 and doc2, they should both success,or If one doc create failed, the other doc should not be saved. they are in the one transaction.