Mongoose plugin to track likes for an object
Mongoose plugin to track likes/dislikes for an object. This is a customisation of the mongoose-votes plugin which changes the terminology to be more appropriate for likes/dislikes.
This plugin is currently unstable and not thoroughly tested. Please refrain from using it at the present time.
var mongoose = ;var likesPlugin = ;var postSchema = mongoose;postSchema;var Post = mongoose;
var p = ... ; // some post objectp;p;// These functions are also defined as staticsPost;Post;
p;p;// These functions are also defined as staticsPost;Post;
findDislikes works in the same manner
plikes // total number of likespdislikes // total number of dislikespscore // virtual, likes - dislikesplikers // array of all likerspdislikers // array of all dislikers
mongoose-likes can be customised in a number of ways. Here is a list of all options with their default values: