Dear ALL
I am a primary developer to couchbase mobile solution. Could help me finish my first push filter.
My requirements are as the followings.
At mobile (lite) site ,each user creates and modifies his profile doc. This profile doc will be pushed to sync gateway and only pulled to this user's other signed-on devices filtered by username. So I need to figure out the mobile site code and sync config.
This is my doc property:
var properties = new Dictionary<string, object>()
{
{"username", "jacob"}
{"type", "profiles"},
{"message", "jacob's Personal Data"}
{"created_at", DateTime.UtcNow.ToString("o")},
};
This is the code from Official website. But I don't know how to adapt it to my requirement.
database.SetFilter("byOwner", (revision, filterParams) =>
{
var nameParam = filterParams["name"];
var owner = (string)revision.GetProperty("owner");
return (nameParam != null) && nameParam.Equals(owner);
});
var push = database.CreatePushReplication(url);
push.Filter = "byOwner";
push.FilterParams = new Dictionary<string, object> { {"name", "Waldo"} };
This is my sync config.json. How to code it's sync part ?
"profiles":{
"bucket": "profiles",
"users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }
},
Thinks a lot.
Jacob L. @ Taiwan