Query execution in mobile

mobile
query

#1

Hi

i’m a hybrid mobile application developer i have few doubts on couchbase lite

#1 sync works good but i need to sync only specific users data only like device A users data not for device B how to succeed this.

#2 how to perform joins between the docs


#2

you can route specific users data to specific users’s channel, and assign the channels to the specific users
FYI
https://developer.couchbase.com/documentation/mobile/1.4/guides/sync-gateway/channels/index.html

FYI


page 18


#3

Couchbase Lite 2 (currently in “Developer Build” early access) has a more powerful query system that can do joins.


#4

Hi @atom_yang

i tried the pseudo joins nut it’s not works for me can you please help me to solve this.

sample json

{
Description:null,
accessId:“88d699f6-12c7-0ab3-6c5d-b4f4614339b4”,
bizId:“646ef779-db26-44df-b4dc-5dcb4c09bab6”,
bizPct:"",
brcId:“8c08eb2b-465f-ec8e-ca9f-fc5c232c3f66”,
brcPct:“32”,
cBy:null,
cDate:“2017-10-23T12:55:27.624Z”,
empStatus:“Employee”,
lnID:"",
lnPct:"",
recHistory:1,
rev:“1-fd98ae39488f8c9cad1631dd291fa838”,
roleType:2,
title:“access”,
userId:“e9c341b2-d19c-4ee6-b54d-9d01db7deaae”
}

{
GSTNo:“Ghh”,
License:null,
Name:“Business 2”,
OverallRating:null,
bizId:"b72fa559-097b-7a0f-0b48-d04c6936ec13"
cBy:null
cDate:“2017-10-12T11:50:25.692Z”,
logo:“Ghh”,
panNo:“2585266588225855”,
regNo:null,
rev:“7-8e0734812fe7280945e74c9a6292cff4”,
sName:“Biz2”,
title:“business”,
website:“Gh”,
_id:“646ef779-db26-44df-b4dc-5dcb4c09bab6”
}

i tired to get back the business name from business doc while mapping the access data

access:{
map: function(doc) {
switch (doc.title){
case “access”:
emit(doc._id, {accessId:doc.accessId,title:doc.title,userId:doc.userId,bizId:doc.bizId,bizPct:doc.bizPct,brcId:doc.brcId,brcPct:doc.brcPct,lnID:doc.lnID,lnPct:doc.lnPct,roleType:doc.roleType,Description :doc.Description,empStatus:doc.empStatus,recHistory:doc.recHistory,cBy:doc.cBy,cDate:doc.cDate,rev: doc._rev});
case “business”:
emit(doc.Name,null);
}
}
}