I’m going to use Couchbase lite on RPi. Using Java Couchbase Lite ti sync with Couchbase server using Couchbase sync gateway and we have a server application also with is written in Java.
In Couchbase Java SDK we use JSONObjects and in Couchbase lite java SDK we use Documents. Can I use JSONObject class with Couchbase lite?
Also sync gateway creates additional objects on bucket. Is there any way to hide them or remove them?
You can’t use the Server SDK with Couchbase Lite; they’re different things. Couchbase Server and Couchbase Mobile have different document models, because Mobile includes versioning (revisions) which are necessary for replication.
Also sync gateway creates additional objects on bucket. Is there any way to hide them or remove them?
No, that’s metadata needed to track document revisions and handle conflicts. You should ignore those properties, and you should never modify anything in Sync Gateway’s bucket.
@jens Thank you. I don’t need Revision support in this scenario. Since this incident we want only to create documents and reporting will be handled in server side.
I there a way to achieve this without sync gateway then?
You might not need Couchbase Mobile at all. For example you could just write a simple servlet that accepts JSON and adds a document to the server, and then POST to that servlet’s URL from the Raspberry Pi.
It’s hard to say more because I don’t know what your needs are.
I need to collect record about few events and the object I need to save is only have four fields and it create a object on an event triggered by user and it will save to database.
Sometimes RPi don’t have Network connectivity for that I need offline ability. Later when connectivity came data need to push to server.
Server also doesn’t edit the objects created by RPi and only create records. (May needs to delete functionality)
Well, you can either use Couchbase Mobile, and accept that it has some complexity you don’t need, due to its revision support;
or you can implement the offline support yourself, by keeping a local persistent queue of JSON objects and POSTing them to the server when connectivity permits.