adding attributs in sync function?

15 views
Skip to first unread message

Seung Chan Lim

unread,
Jul 13, 2014, 10:33:40 PM7/13/14
to mobile-c...@googlegroups.com
Is it possible to add an attribute to a document in the sync funciton? For example. add a "last updated" attribute on a document with time stamp "JSON.stringify(new Date())"?

I'm hoping to synchronize the clock using server-side clock not client-side.

Jens Alfke

unread,
Jul 14, 2014, 12:28:44 AM7/14/14
to mobile-c...@googlegroups.com

On Jul 13, 2014, at 7:33 PM, Seung Chan Lim <djs...@gmail.com> wrote:

Is it possible to add an attribute to a document in the sync funciton? For example. add a "last updated" attribute on a document with time stamp "JSON.stringify(new Date())"?

No; that would mess up the revision tracking, because you’d effectively be creating a new revision of the document every time it got replicated to the server. (And then that revision would get replicated back to every client…)

Generally you’d have the client update that timestamp when it modifies a document. It’s usually more useful to know the time at which the document was actually created/updated, rather than the time that it got synced to the server.

—Jens
Reply all
Reply to author
Forward
0 new messages