I have an Ember app that is interfacing with Couchbase Lite via ember-couchdb-kit.
I would like to run it on a desktop. I have used CouchDB successfully in the past, but want to migrate to Couchbase Server to better control data access.
Ember-couch-kit relies on an all
view to return elements of a particular type. For example, my app has habits, the url used for loading those is:
/db/_design/habit/_view/all?include_docs=true&key="habit"
The map function looks like:
function( doc ) { emit( doc.type, null ) }
As best I can tell, CouchDB and Couchbase Lite return a result of the form:
{
"total_rows":19,
"offset":0,
"rows":[
{
"id":"ce236fe89785d8190abc37e01c001087",
"key":"habit",
"value":null,
"doc":{
"_id":"ce236fe89785d8190abc37e01c001087",
"_rev":"5-1a6274e9f8020e03277f764fd3fb6bba",
"type":"habit",
"name":"Test",
"color":"#000000",
"events":["ce236fe89785d8190abc37e01c00267d",…]
}
},
⋮
Couchbase Server, on the other hand, returns a document of the form:
{
"total_rows":1541,
"rows":[
{
"id":"habit:150mg buoropion",
"key":"habit",
"value":null,
"doc":{
"meta":{
"id":"habit:150mg buoropion",
"rev":"1-00000700e0f3239a0000000000000000",
"expiration":0,
"flags":0
},
"json":{
"type":"habit",
"name":"150mg Buoropion",
"color":"#D4A475"
}
}
},
⋮
Is there way to use Sync Gateway to get a compatible view? Currently, I am working around it currently by returning the document as the value from the map
.