Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a plugin that can track data change and sync to client? #3166

Closed
jackiesun8 opened this issue Jul 15, 2015 · 4 comments
Closed

Is there a plugin that can track data change and sync to client? #3166

jackiesun8 opened this issue Jul 15, 2015 · 4 comments
Labels
new feature This change adds new functionality, like a new method or class plugin

Comments

@jackiesun8
Copy link

I use mongoose in a game server development. Mongoose has ability to track data change and sync to database.Now I want to sync data to client at data change.But this sync mechanism can't use mongoose's build-in.Because the sync opportunity is various(database'data is cached in memory and sync to database at player offline)

@vkarpov15
Copy link
Collaborator

Not that I know of. Node's Object.observe() function may be helpful, but I'm not sure how well that'll work with mongoose documents. I would try: Object.observe(doc._doc, function() {});

@vkarpov15 vkarpov15 added new feature This change adds new functionality, like a new method or class plugin labels Jul 15, 2015
@jackiesun8
Copy link
Author

@vkarpov15 mongoose's mechanism about tracking data change is?

@vkarpov15
Copy link
Collaborator

Not very extensible I'm afraid. At a high level, mongoose uses Object.defineProperty() to define custom getters/setters for every field you define in your schema and uses those to track changes on documents.

@onbjerg
Copy link

onbjerg commented Jan 19, 2016

Hmm, if I understand correctly this could prove useful: https://github.com/mWater/minimongo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This change adds new functionality, like a new method or class plugin
Projects
None yet
Development

No branches or pull requests

3 participants