Hello Team,
I have used Couchbase-Lite-PhoneGap-Plugin plugin in sencha touch. I have used rest API’s to read write the data in CB database.
Implementaion steps:
Request URL: http://e223578e-0d56-41b7-84e6-560390315141:6cda07f0-c908-45c1-8080-d4b38f627410@localhost:5984/dbName
-
Created database
PUT : …/@localhost:5984/dbName
Status: 200 succecss -
Create Design documents
PUT: …/dbName/_design/designDocName
Request Param :
{
xyz:{
map: function(doc){
if(doc.type == “xyz”){
emit(doc.id, doc);
//emit(doc.name, doc);// if required
}
}.toString()
}
}
status : 200 success -
Write data in DB:
POST : …/dbName/_bulk_docs
Status Code: 200 success.
var docs = {
“docs” : records,
“new_edits” : true,
};
Here records is array or data in following format
{
_id: 1,
type: ‘xyz’,
…
…
…
} -
Retrive data form database
GET : …/dbName/_design/designDocName/_view/xyz
Status Code: 404 Not found
The step 4 always return 404 error. Please correct me if anything wrong in above request or suggest wat to get the data form couchbase.