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

mowr

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mowr

A very thin convenience wrapper for the Mongo client.

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

Mowr 😺 makes using the Mongo client more comfy

npm GitHub file size in bytes
A very thin convenience wrapper for the Mongo client.

Installation

npm i mowr

Usage

const db = require('mowr')('localhost:27017/test', options)
const collection = db.get('collection')

const collection = require('mowr')('localhost/test', options).get('collection')

Supported calls

collection.find(query, options)    // returns array
collection.findc(query, options)   // returns cursor
collection.findOne(query, options) // returns object

collection.insert(object/array, options) // returns inserted object/array
collection.insertOne(object, options)    // returns inserted object
collection.insertMany(array, options)    // returns inserted array

collection.updateOne(query, update, options)  // -> {n: 1, nModified: 1, ok: 1}
collection.updateMany(query, update, options) // -> {n: 5, nModified: 5, ok: 1}
collection.replaceOne(query, update, options) // -> {n: 1, nModified: 1, ok: 1}

collection.deleteOne(query, options)  // -> {n: 1, ok: 1}
collection.deleteMany(query, options) // -> {n: 5, ok: 1}

collection.findOneAndUpdate(query, update, options)  // returns original document
collection.findOneAndReplace(query, update, options) // returns original document
collection.findOneAndDelete(query, options)          // returns deleted document

Options are always optional, and passed as object.

When connecting, 'mongodb://' is prepended if needed, and useUnifiedTopology is set to true (pass it as option to set it to false).

The query field can be an _id string (it will be converted to {_id: <ObjectID>}) or a query object.

Depending on if an object or array is passed in, insert will call insertOne or insertMany.

If an update object contains an _id property, even if nested, it will be removed.

When passing options using find, findc, findOne, make sure to use a query (can be {}).

Thanks to @fuzetsu for his invaluable help!

Keywords

mongo

FAQs

Package last updated on 18 Nov 2020

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