MCPcopy Index your code
hub / github.com/Automattic/monk

github.com/Automattic/monk @v7.3.2 sqlite

repository ↗ · DeepWiki ↗ · release v7.3.2 ↗
18 symbols 30 edges 16 files 1 documented · 6%
README

Monk

A tiny layer that provides simple yet substantial usability improvements for MongoDB usage within Node.JS.

build status codecov Join the chat at https://gitter.im/Automattic/monk

note: monk 2.x drop the support for node < 0.12. If you are still using an earlier version, stick to monk 1.x

const db = require('monk')('localhost/mydb')
// or
// const db = require('monk')('user:pass@localhost:port/mydb')

const users = db.get('users')

users.index('name last')
users.insert({ name: 'Tobi', bigdata: {} })
users.find({ name: 'Loki' }, '-bigdata').then(function () {
  // exclude bigdata field
})
users.find({}, {sort: {name: 1}}).then(function () {
  // sorted by name field
})
users.remove({ name: 'Loki' })

db.close()

Features

  • Well-designed API signatures
  • Easy connections / configuration
  • Command buffering. You can start querying right away
  • Promises built-in for all queries. Easy interoperability with modules
  • Auto-casting of _id in queries
  • Allows to set global options or collection-level options for queries. (eg: castIds is true by default for all queries)

Middlewares

Most of the Monk's features are implemented as middleware.

There are a bunch of third-parties middlewares that add even more functionalities to Monk: - monk-middleware-wrap-non-dollar-update - monk-middleware-debug - monk-middleware-dereference

Created an nice middleware? Send a PR to add to the list!

How to use

Documentation

License

MIT

Extension points exported contracts — how you extend this code

IObjectID (Interface)
(no doc)
index.d.ts

Core symbols most depended-on inside this repo

close
called by 4
lib/manager.js
fields
called by 3
middlewares/options/index.js
pause
called by 2
lib/collection.js
resume
called by 2
lib/collection.js
done
called by 1
lib/collection.js
thenFn
called by 1
middlewares/handle-callback/index.js
catchFn
called by 1
middlewares/handle-callback/index.js
Collection
called by 0
lib/collection.js

Shape

Function 13
Class 4
Interface 1

Languages

TypeScript100%

Modules by API surface

lib/collection.js5 symbols
index.d.ts5 symbols
test/collection.js3 symbols
middlewares/handle-callback/index.js2 symbols
lib/manager.js2 symbols
middlewares/options/index.js1 symbols

Dependencies from manifests, versioned

@types/mongodb3.5.25 · 1×
ava0.19.1 · 1×
codecov2.2.0 · 1×
debug* · 1×
eslint3.19.0 · 1×
eslint-config-standard10.2.1 · 1×
eslint-plugin-ava4.2.0 · 1×
eslint-plugin-node4.2.2 · 1×
eslint-plugin-promise3.5.0 · 1×
eslint-plugin-standard3.0.1 · 1×
gitbook-cli2.3.0 · 1×

Datastores touched

(mongodb)Database · 1 repos

For agents

$ claude mcp add monk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact