Documents created using Ottoman need to fetch using pouchdb


Hi Team,

I have created documents using Ottoman and Nodejs.

Example document structure given below:

"_type": “groups”,
“group_members”: [
"_type": “subscribers”,
"$ref": “7d4ab00e-26b8-45ae-93b9-9a4c1e29e584”
"_type": “subscribers”,
"$ref": “10ce32d6-252e-41d4-b63a-cf240740eb27”
"_type": “subscribers”,
"$ref": “f98aaaa6-dae3-4788-8983-cdeb1df26b25”
“channels”: [
“stores users email”
“created_on”: “2016-04-16T11:58:06.976Z”,
"_id": “be0790db-ebf4-4ebf-9e6e-d3ac5590576e”,
“group_name”: “Test Group”,
“created_by”: {
"_type": “users”,
"$ref": “f13368cf-7bb7-438b-b5e8-6638b9fa7273”

Now, I am trying to fetch these documents using pouchdb via sync gateway.

I also, tried to replicate the pouchdb document structure which has fields like “type”, “channels” and “_rev” etc.
However, was unable to create a document using the above fields as Ottoman doesn’t allow me to add fields like “type”, “_rev”.
(As in the above example Ottoman already adds “_type” object to the document which is same as the document “type” added explicitly when creating a document using pouchdb).

When trying to fetch these documents via sync gateway, in sync gateway logs it shows me error like “Unable to unmarshall data”.

So, how should I go about this issue?

Thanks and Regards,



Currently Ottoman depends on underscored properties (_type in particular) that aren’t compatible with Sync Gateway.

I’ve filed a Sync Gateway issue to track compatibility - either by making the underscored property names configurable in Ottoman, or by allowing those properties through to Sync Gateway.


@adamf - There must be same way to insert data programmatically into couchbase master database that allows it then be synced by the Sync Gateway. What is the recommended / best practice? We are simply trying to sync data between a web app and a mobile app and this must be a very common use case. Any help is appreciated!




Use the CRUD operations in the Sync Gateway REST API.