Not able to fetch data

mobile

#1

I have changes design document as follows:
{
views:{
xyz:{
map: function(doc){
if(doc.type == “xyz”){
emit(doc.id, doc);
//emit(doc.name, doc);// if required
}
}.toString()
}
}
}

Still not able to fetch the documents. Now it returns 200 with 0 records in view and design document in get_all_docs

Retrive data form database
GET : …/dbName/_design/designDocName/_view/xyz
Status Code: 200
The step 4 return {“total_rows”:0,“offset”:0,“rows”:[]}.

I have also tried to get all documents using following api
GET : …/dbName/_all_docs
Status Code: 200
response: {
offset :0
doc:null
id:"_design/designDocName"
key:"_design/designDocName"
value:{_conflicts: Array(0), rev: “1-5f468ba8f7558e9cd52c63aad2023eef”}
total_rows:1
}

Please help me to fetch the data from couchbase.


#2

If _all_docs only returned one document, then there’s only one document in the database. It doesn’t have a type property, which explains why your view didn’t return it.


#3

_all_docs return design document as I have mentioned in above response. I have used following method to write data in couchbase 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’,



}]

Please help me as soon as possible.


#4

_bulk_docs returns 200 if the overall request succeeded, whether or not individual documents were updated. You have to look at the JSON in the response to see the status of each document in your “docs” array.

When you say “write data in Couchbase DB”, you mean the DB on the device? Are you using PhoneGap?


#5

For mobile application development, I am using cordova and for couchbase “Couchbase-Lite-PhoneGap-Plugin” and sencha touch.