A tagging plugin for Mongoosejs.
This is a basic plugin which adds a tags
field to a collection schema, and provides statics methods and instance methods for adding and removing these tags.
Tags are simply an array of document identifiers which reference your tags collection.
TODO: publish to npm.
Add to package.json
"dependencies": {
"node-mongoose-tags": "rolandnsharp/node-mongoose-tags"
}
Install npm install
.
var mongoose = require('mongoose');
schema = mongoose.Schema;
schema.plugin(require('node-mongoose-tags'));
Adds the tagIds
to the tags
field of all documents of documentIds
.
Removes the tagIds
from the tags
field of all documents with id's of documentIds
.
Gets all tags of documentId
.
Run npm test