Socket
Book a DemoInstallSign in
Socket

mongo-minify

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo-minify

Minifies a given MongoDB update query based on fields restrictions (inclusion or exclusion).

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

mongo-minify

Minifies a given MongoDB update query based on fields restrictions (inclusion or exclusion).

Example

var minify = require('mongo-minify');

minify({ $set: { a: 'b' }, $push: { 'c': 'd' } }, { a: 0 });
// { $push: { c: 'd' } }

minify({ $push: { c: 'd', e: 'f' }, $unset: { h: 1 } }, { e: 1 });
// { $push: { e: 'f' } }

minify({ $set: { 'name.first': 'Guillermo', age: 50 } }, { name: 1 });
// { $set: { 'name.first': 'Guillermo' } }

API

minify(query[, restrictions])

query is any update or findAndModify query passed to MongoDB.

restrictions is the fields selection format used with find*.

FAQs

Package last updated on 07 Feb 2014

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