
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
mongoose-plugin-votes
Advanced tools
A mongoose.js plugin that provides vote
and unvote
methods for model instances. The method names are configurable (e.g. like
and unlike
).
Note: document changes are not persisted until document is saved.
npm i --save mongoose-plugin-votes
Example
var votesPlugin = require('mongoose-plugin-votes');
var schema = Schema({...});
schema.plugin(votesPlugin[, OPTIONS]);
Kind: inner property of mongoose-plugin-votes
Param | Type | Default | Description |
---|---|---|---|
[options] | object | ||
options.path | string | "votes" | the path to create the propterty for storing votes. |
options.options | object | property options to set (type will always be Array ). (e.g. {select: false}) | |
options.voteMethodName | string | "vote" | the method name to set a vote. |
options.unvoteMethodName | string | "unvote" | the method name to unset a vote. |
options.votes | object | ||
options.votes.ref | string | the reference model to use (e.g. {votes: {ref: 'ModelRefName'}}) | |
options.votes.options | object | votes property options to set (type will always be String ). (e.g. {votes: {options: {select: false}}}) |
The vote
method appends the passed in value to the votes
path array
Kind: inner method of mongoose-plugin-votes
Param | Type | Description |
---|---|---|
voter | * | If using a reference pass in the ObjectId or the document |
The unvote
method removes the passed in value from the votes
path array
Kind: inner method of mongoose-plugin-votes
Param | Type | Description |
---|---|---|
voter | * | If using a reference pass in the ObjectId or the document |
var votesPlugin = require('mongoose-plugin-votes');
var schema = Schema({foo: String});
schema.plugin(votesPlugin);
var Foo = mongoose.model('Foo', schema);
var foo = Foo(); // foo.votes --> []
foo.vote('candy'); // foo.votes --> ['candy']
foo.vote('candy'); // foo.votes --> ['candy']
foo.vote('ice cream'); // foo.votes --> ['candy', 'ice cream']
foo.unvote('candy'); // foo.votes --> ['ice cream']
var votesPlugin = require('mongoose-plugin-votes');
var schema = Schema({foo: String});
schema.plugin(votesPlugin, {votes: {ref: 'UserModel'}});
var Foo = mongoose.model('Foo', schema);
var foo = Foo(); // foo.votes --> []
foo.vote(userA); // foo.votes --> [{_id: '507f191e810c19729de860ea'}]
foo.vote(userA.id); // foo.votes --> [{_id: '507f191e810c19729de860ea'}]
foo.vote(userB); // foo.votes --> [{_id: '507f191e810c19729de860ea'}, {_id: '507f191e810c19729de970fb'}]
foo.unvote(userA); // foo.votes --> [{_id: '507f191e810c19729de970fb'}]
Apache 2.0
FAQs
Mongoose.js plugin to add voting methods to models.
We found that mongoose-plugin-votes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.