New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

mongoose-taggable

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-taggable

Simple tagging plugin for Mongoose

latest
Source
npmnpm
Version
0.5.0
Version published
Maintainers
1
Created
Source

#mongoose-taggable

A simple tagging plugin for Mongoose

Adds the ability to add and remove tags to a document, and find models filtered by tags. Uses safe atomic updates to avoid race conditions.

NOTE: Indexes are not applied to the tags path, because you should probably use a compound index with other paths in your schema

##API

###model.addTag(tag) Add a tag (in memory only)

  • @param {String} tag The tag to add

  • @return {Boolean} False if tag already existed; true if added

###model.addTag(tag, cb) Add a tag to a document atomically

NOTE: This method modifies the document on the database

  • @param {String} tag The tag to add
  • @param {Function} cb Callback(err, addedTag) addedTag will be false if tag already existed; true if added

###model.removeTag(tag) Remove a tag (in memory only)

  • @param {String} tag The tag to add

  • @return {Boolean} False if tag didn't exist; true if removed

###model.removeTag(tag, cb) Remove a tag from a document atomically

NOTE: This method modifies the document on the database

  • @param {String} tag The tag to remove
  • @param {Function} cb Callback(err, removedTag) removedTag will be false if tag didn't exist; true if removed

###model.hasTag(tag) Returns whether the document as a given tag

  • @param {String} tag

  • @return {Boolean}

###Model.filterByTags(query, includeTags, [excludeTags]) Alters a query to filter by tags.

  • @param {Query} query Mongoose query object
  • @param {String[]} includeTags Tags the document must have (must have all)
  • @param {String[]} excludeTags Tags the document must NOT have (must not have any)

##Changelog ###v0.5.0

  • Changed the way excludeTags works in filterByTags(), from an AND operation to an OR operation. The method now selects items that have ALL of the includeTags but filters out items that have ANY of the excludeTags.

Keywords

mongoose

FAQs

Package last updated on 31 May 2013

Did you know?

Socket

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.

Install

Related posts