I’m working in a new project that the main change is move MongoDB+Mongoose to CouchbaseServer+Ottoman+SyncGateway+CouchbaseMobile. I’m reading some articles and find a lot of questions about Ottoman _type field and incompatibility with Couchbase Mobile but I don’t see any solution for that.
The use of underscore is clearly documented in Couchbase Mobile/Lite Docs.: https://developer.couchbase.com/documentation/mobile/current/guides/couchbase-lite/native-api/document/index.html
Can anyone help me to workaround this “problem” in Ottoman?
I know this has come up before, but I could only find one relevant post on the forum and it didn’t give an answer.
You might also try searching on CouchDB-related forums/lists, as CouchDB has the exact same data model, so this issue would also come up with it.
Thanks for your reply. I’ll try your suggestion for while … It’s all that i have
If I find a workaround, then I’ll come back to this post with the solution …
Ottoman team: I don’t want to break the compatibility changing ORM code or using my own solution … Is it simple to change/add parameters(removing underscore of _type key) in next Ottoman release once this is a knowed issue related with SG and CM? I’m sorry if you guys are already working on it …
I have a similar setup working with a forked version of Ottoman, the code can be found here https://github.com/Keepsite/node-ottoman/tree/develop
$ as a default prefix for both the
typeKey but these can be overwritten in your application code.
There are a few other diverging changes in this branch that would make an upstream pull request difficult hence why I haven’t bothered as yet.
As I understand Ottoman v2.0 is in the works so there could be an official solution as a part of that.
I’m also using a Shadow Bucket to achieve consistency between Web and Mobile applications (I assume you will need to do the same). Apparently this is no longer necessary with Sync Gateway 1.5 but it is currently in Beta and initial tests also caused trouble with Ottoman. Might look at a workaround soon.
Thanks for your reply!
I did not know about shadow buckets, but in a quick googled I found it - One more time, Jens helping the people : Does Bucket shadowing is recommended way to sync data between server and mobile?
Within all alternatives, changing Ottoman code seems to be less traumatic in subsequent refactoring point of view.
Bucket shadowing is deprecated after V1.4 of Sync Gateway. So if you just getting started, it’s probably best to avoid using it. So if you need mobile/web client sync, the recommended approach in V1.4 is to use the Sync Gateway REST API for adding all documents .
From SG 1.5 onwards content across mobile and non mobile clients will be synchronized automatically regardless of whether the documents were added to the Couchbase Server via the Sync Gateway or via the SDKs.
You can download SG 1.5 (in Beta2) and start using it right away.
You can learn more about the unified access in this blog post . This tutorial goes into gory details (It also uses features in Couchbase Lite 2.0 but you can refer to it for the Sync Gateway 1.5 side of things).