Ideal Replication Filter for JSON based Databases Like Couchbase, CouchbaseLite, CouchDB, etc.? -


i write filter function on couchdb server side to filter documents specific user. filter allow replication few selected documents particular user has access rather whole database of tbs of size.

here found similar question couchdb: restricting users replicating own documents not provide me info need.

so questions remain:

  1. what can best approach specify such filter?
  2. how should write such filter function, written example?
  3. what should include in every doc filter work way:

    in context of social network, suppose want fetch user data pictures server, in case document containing pictures holding userid in it. can case when friends of person visit profile , able view photos. in case whenever friend visits profile picture doc replicated friend , able view pictures also.

how can accomplish such filter?

more info: on mobile platform side using couchbaselite , on server side using couchdb. want filtered documents on mobile platform.

a couchdb filter function has access single document being filtered, can't use information other documents. rules out "join-like" approaches, dereferencing photo-post doc owner doc owner's list of friends.

basically have include property in every document lists exact set of users should it.

also, note doesn't provide sort of access control. there no way selectively deny read access documents in couchdb, can't prevent user viewing stranger's photo albums. you'd have go database-per-user approach, has own drawbacks — end having set lot of replications between databases share documents between them, doesn't scale well.

take @ at couchbase sync gateway (https://github.com/couchbase/sync_gateway) -- it's replication-compatible couchdb adds features enable kind of selective sync , access control. should feasible implement social network it; that's 1 of use cases had in mind when designed it. (i'm lead engineer on project.)


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -