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

Mongoose models fail to sync #42

Open
tracend opened this issue Mar 21, 2013 · 0 comments
Open

Mongoose models fail to sync #42

tracend opened this issue Mar 21, 2013 · 0 comments
Labels

Comments

@tracend
Copy link
Member

tracend commented Mar 21, 2013

After the latest update to Mongoose (v3.6) the models aren't always available in their expected form.

Most likely this has to do with passing the models as constructors from one file to the other - which is not considered best practice.

When they reach the Sync class they have 'lost' their constructor attributes (schema etc.)

Console.log:

    backend.handle(req, res, function(err) {
            ^
TypeError: Object function model(doc, fields, skipId) {
    if (!(this instanceof model))
      return new model(doc, fields, skipId);
    Model.call(this, doc, fields, skipId);
  } has no method 'handle'
    at Sync.handle (/Users/tracend/Repositories/Websites/assetorium/node_modules/crudr/lib/sync.js:55:13)
    at Sockets.events.Object.keys.forEach.self.io.of.on.events.created (/Users/tracend/Repositories/Websites/assetorium/node_modules/crudr/lib/sockets.js:115:11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant