Questions tagged [mongoose-plugins]

Mongoose provides a straight-forward, schema-based solution to modeling your application data and includes built-in type casting, validation, query building, business logic hooks and more, out of the box.

79 questions
0
votes
0 answers

MongooseJS - Return query after performing a count followed by a find

I would like to get the number of objects in a Collection and then use that number to perform a find. The code currently looks like this: function() { TestModel.count({}, function(err, num) { if (err) { return callback(err, undefined); …
Larry Price
  • 429
  • 1
  • 4
  • 15
0
votes
1 answer

Mongoose: use plugin in Schema static method

I use mongoose random plugin. In my schema definition i call GameSchema.plugin(random, { path: 'r' }); After that I have a custom static method who use the plugin: GameSchema.statics.someMethod { [...] GameSchema.findRandom... …
Nihau
  • 474
  • 3
  • 20
0
votes
1 answer

Passport-Local-Mongoose – When I Update A Record's Username, I'm Logged Out, Why?

I'm using the MEAN stack with passport and the Passport-Local-Mongoose plugin. However, whenever I update a User record's username, I am logged out of my current session. What is the correct way to update a username with…
ac360
  • 7,735
  • 13
  • 52
  • 91
-1
votes
1 answer

this.find(...) never reaches callback within static method

I am working on a module which adds Friendship-based relationships to a Schema. I'm basically trying to do what this guy is trying to do (which, AFAIK, should work--which is discouraging) Why is find(...) in FriendshipSchema.statics.getFriends…
techjeffharris
  • 392
  • 2
  • 13
1 2 3 4 5
6