Skip to content

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

@ricick

Description

@ricick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions