Call Help to First push filter

12 views
Skip to first unread message

Jacob L.

unread,
May 29, 2015, 11:55:04 AM5/29/15
to mobile-c...@googlegroups.com
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":{
      "server":"http://172.16.84.217:8091",
      "bucket": "profiles",
      "users": { "GUEST": { "disabled": false, "admin_channels": ["*"]  } }
    },

Thinks a lot.

Jacob L. @ Taiwan

Jens Alfke

unread,
May 29, 2015, 12:08:49 PM5/29/15
to mobile-c...@googlegroups.com

On May 29, 2015, at 3:41 AM, Jacob L. <ukljm...@gmail.com> wrote:

I am a primary developer to couchbase mobile solution. Could help me finish my first push filter.

From your requirements it doesn’t sound like you need a push filter.

Or if you do, you’ll have to explain to us what it’s supposed to do. Your description is pretty vague and you’re asking for a lot — it’s better to ask specific questions, because you can’t expect people here to design & write your code for you. (Well, not unless you hire them as consultants…)

—Jens

Reply all
Reply to author
Forward
0 new messages