I have two docs like this:
*{"_id":"doc1","type":"TYPE1","key":"200","create_time":201506231000,"field1":"a","field2":"b"}*
*{"_id":"doc2","type":"TYPE2","key":"200","create_time":201506241200,"field3":"c"}*
My Map function like this:
function (doc,meta) {
if (doc.type == "TYPE1" && doc.key && doc.create_time && doc.field1 && doc
.field2){
emit(doc.key,{"create_time":doc.create_time,"type":doc.type,"field": {
"field1":doc.field1,"field2":doc.field2}});
} else if (doc.type == "TYPE2" && doc.key && doc.create_time && doc.field3
){
emit(doc.key,{"create_time":doc.create_time,"type":doc.type,"field": {
"field3":doc.field3}});
}
}
so I can get the following result by key = "200" ( which I want to get)
*{"total_rows":2,"rows":[*
*{"id":"doc1","key":"200","value":{"create_time":201506231000,"type":"TYPE1","field":{"field1":"a","field2":"b"}}},*
*{"id":"doc2","key":"200","value":{"create_time":201506241200,"type":"TYPE2","field":{"field3":"c"}}}*
*]*
*}*
Is this function be the correct usage ? or what principle should I
following on developing view both couchbase server and couchbase Lite?
and If I want to sort by *create_time* and using paging , what should I do?
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/3344e732-03be-4f38-85e7-bb38f5507b4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.