I have a couchbase server and I am trying to create some views but it seems that I don't have the full understanding of views concept. I have the two following example documents:
{
"id": 70,
"status": 2,
"updatedAt": "2014-09-04T08:52:29.969Z",
"createdAt": "2014-09-03T21:32:19.000Z",
"user1": {
"id": 33185,
....
},
"user2": {
"id": 40838,
.....
}
}
{
"id": 71,
"status": 4,
"updatedAt": "2014-09-03T21:33:09.404Z",
"createdAt": "2014-09-03T21:32:20.000Z",
"user1": {
"id": 37126,
....
},
"user2": {
"id": 36094,
.....
}
}
when I create a view with this map function:
function (doc, meta) {
if (doc.user1 && doc.user2) {
emit(doc.id, doc);
}
}
the first document (with id: 70) is not returned by the view while the second is. I didn't understand why even though both have user1 and user2.
Any help is very appreciated.