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

Plugin not working with mongoose ^4.7.7 via trailpack-mongoose #21

Open
ricick opened this issue Mar 21, 2018 · 0 comments
Open

Plugin not working with mongoose ^4.7.7 via trailpack-mongoose #21

ricick opened this issue Mar 21, 2018 · 0 comments

Comments

@ricick
Copy link

ricick commented Mar 21, 2018

Hey i'm building a trailsjs based application with a mongo db managed via the trailpack-mongoose addon.

The current release of this addon uses mongoose ^4.7.7.

When i install this plugin in one of my trails models like so:

...
class MyModel extends Model {
  static config() {
    let config  = {}
    config.onSchema = (app, schema)=>{
      schema.plugin(idvalidator);
    }
    return config
  }
  ...

any calls to save a document hang.

let item = new MyModel(object);
item.save().then(neverGetsCalled)

I've been through the internals of the plugin and mongoose. and it seems to be an issue with the exec method in mongoose/lib/query.js on line 3087 that is called by the executeQuery method of this library . If the callback is passed as a second parameter to exec, as this library does, it is called by an internal promise resolve call, but the promise never resolves. I've tried changing this library to use a promise instead of passing a callback, but again it never resolves.

Any help would be greatly appreciated. I find it hard to imagine that this is an unknown mongoose issue with such an important method as query.exec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant