I have a website running on local PouchDb and i have some transaction docs on Couchbase server for different regions. I need to sync the transaction data to pouchdb from couchbase specific to the region that website belongs.
For e.g. my local website’s pouch db has data for region called USA and Couchbase server has data for multiple regions like USA, Germany, Europe etc. Then i just need to sync the data for USA from couchbase server to my local pouchdb.
Please help. how i can achieve this. Tried with import filter for sync gateway but no lock.
My sync gateway config looks like below -
{
“log”:[""],
“databases”: {
“transactions”: {
“server”: “http://localhost:8091”,
“bucket”: “exp_transactions”,
“username”: “xyz”,
“password”: “pass@123”,
“enable_shared_bucket_access”: true,
“import_docs”: true,
“num_index_replicas”: 0,
“import_filter”: function(doc) { if (doc.type != “transactions”) { return false } return true } ,
“users”: {
“GUEST”: {
“disabled”: false,
“admin_channels”: [""]
}
},
“num_index_replicas”: 0
}
},
“CORS”: {
“Origin”: [“http://127.0.0.1:8200”],
“LoginOrigin”: [“http://127.0.0.1:8200”],
“Headers”: [“Content-Type”],
“MaxAge”: 17280000
}
}
From my website page e.g. home.ts calling sync method of pouchdb
TRANSACTIONS.replicate.to(COUCHBASE_URL,{live:true}).then(data=>{
console.log(’----Replicated to Couchbase----’);
});
}