Permalink
Browse files

documented server side sync filtering

  • Loading branch information...
1 parent a3dd885 commit 1a20f3f3cb9af77b4f10f1d7adaa7e83fec58c2e @jacobmumm jacobmumm committed Nov 9, 2011
Showing with 23 additions and 0 deletions.
  1. +23 −0 docs/sync.md
View
@@ -115,6 +115,29 @@ The server must expose a resource located at the given URI that responds to:
{"status": "ok",
"now": 1279888110797}
+
+Server-side filtering
+-------------------
+
+In certain circumstances, it is not necessary or desired to push all records down to a client. A standard GET URI looks like this:
+
+ app.get('/taskupdates', function(req, res) {
+ persistenceSync.pushUpdates(req.conn, req.tx, Task, req.query.since, function(updates){
+ res.send(updates);
+ });
+ });
+
+The third parameter in `pushUpdates` is the Entity model. If you wish to filter, simply pass a Query Collection in its place.
+
+ app.get('/taskupdates', function(req, res) {
+ var taskCollection = Task.all(req.conn).filter('done','=',false);
+ persistenceSync.pushUpdates(req.conn, req.tx, taskCollection, req.query.since, function(updates){
+ res.send(updates);
+ });
+ });
+
+
+
Limitations
-----------

0 comments on commit 1a20f3f

Please sign in to comment.