Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-any-index

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-any-index

Extra index functionality for mongoose

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
2
Weekly downloads
 
Created
Source

mongoose-any-index

Build Status

Mongoose plugin that adds some additional functionality to mongoose indexes:

  1. Lets you add arbitrary indexes to any path, regardless of whether it's specified in your schema. The typical case is when you want sparse indexes within a Mixed type:

    any_index = require 'mongoose-any-index'
    Awesome = new Schema
      email: { type: String, index: true, unique: true, required: true }
      tags: [{type: String}]
      data: { type: Schema.Types.Mixed }
    Awesome.plugin any_index, [
      { keys: { 'data.nested_field': 1 }, options: { unique: true, sparse: true } }
    ]
    
  2. Adds a Model.fullEnsureIndexes(cb) static method that drops indexes not specified in your schema. This lets you avoid "index bloat", since mongoose's Model.ensuresIndexes(cb) by default does not call dropIndex on pre-existing indexes.

Installation

npm install mongoose-any-index

Keywords

FAQs

Package last updated on 17 Sep 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc