npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mongoscope-client

v0.2.8

Published

shush

Downloads

19

Readme

mongoscope-client

build status

A client for wielding mongoscope like the hammer of thor.

Examples are available in ./examples and as a Codepen Collection.

npm install --save mongoscope-client

API

var mongoscope = require('mongoscope-client')([opts]);

Parameters

  • opts (optional, Object) ...
    • scope (String) ... Where mongoscope-server is running default http://localhost:29017
    • seed (String) ... Hostport of mongodb instance default localhost:27017
    • auth (Object) ... Auth spec default {}

resource

Create, read, update and destroy databases, collections, documents and indices.

mongoscope.instance(opts, fn)

production

Get details of the instance you're currently connected to like database_names, results of the hostInfo and buildInfo mongo commands.

Parameters
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.deployments(opts, fn)

production

List all deployments this mongoscope instance has connected to.

Parameters
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.database(name, opts, fn)

production

List collection names and stats.

Parameters
  • name (required, String)
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.collection(ns, opts, fn)

production

Collection stats

Parameters
  • ns (required, String) ... A namespace string, eg #{database_name}.#{collection_name}
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.operation(_id, opts, fn)

development

A currently running operation.

Parameters
  • _id (required, Number)
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.index(ns, name, opts, fn)

development

Index details

Parameters
  • ns (required, String) ... A namespace string, eg #{database_name}.#{collection_name}
  • name (required, String) ... The index name
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.document(ns, _id, opts, fn)

development

Work with a single document.

Parameters
  • ns (required, String) ... A namespace string, eg #{database_name}.#{collection_name}
  • _id (required, String) ... The document's _id value
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.tunnel()

development

Open an ssh tunnel to securely connect to a remote host.

rt

Run MongoDB query operations, including virtual operations such as collection sampling.

mongoscope.top(opts, fn)

production

Capture the deltas of top over opts.interval ms.

Parameters
  • opts (optional, Object) ... Placeholder for future options

    • interval (Number) ... Duration of sample in ms default 1000
  • fn (required, Function) ... A response callback (err, data)

mongoscope.log(opts, fn)

production

A structured view of the ramlog.

Parameters
  • opts (optional, Object) ... Placeholder for future options
  • fn (required, Function) ... A response callback (err, data)

mongoscope.ops(opts, fn)

development

List currently running operations.

Parameters
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.sharding(opts, fn)

development

Get the sharding info for the cluster the instance you're connected to is a member of, similar to the printShardingStatus() helper function in the mongo shell.

Examples
Parameters
  • opts (optional, Object) ... Placeholder for future options
  • fn (required, Function) ... A response callback (err, data)

mongoscope.replication(opts, fn)

development

View current state of all members and oplog details.

Parameters
  • opts (optional, Object) ... Placeholder for future options
  • fn (required, Function) ... A response callback (err, data)

mongoscope.oplog(opts, fn)

development

Get oplog entries.

Parameters
  • opts (optional, Object) ...

    • since (Number) ... Epoch time lower bounds default Date.now() - 1000 * 60
    • filters (Array) ... List of tuples ({key}, {regex}) default []
  • fn (required, Function) ... A response callback (err, data)

mongoscope.analytics(group, opts, fn)

development

Get or stream a group of analytics, which can be any of one durability, operations, memory, replication, network or indexes.

Parameters
  • group (required, String)
  • opts (optional, Object) ... Placeholder for future options
  • fn (optional, Function) ... A response callback (err, data)

query

Run MongoDB query operations, including virtual operations such as collection sampling.

mongoscope.find(ns, opts, fn)

production

Run a query on db.collection.

Parameters
  • ns (required, String) ... A namespace string, eg #{database_name}.#{collection_name}

  • opts (optional, Object) ... Placeholder for future options

    • query (Object) ... default {}
    • limit (Number) ... default 10, max 200
    • skip (Number) ... default 0
    • explain (Boolean) ... Return explain instead of documents default false
    • sort (Object) ... {key: (1|-1)} spec default null
    • fields (Object) ... @todo
    • options (Object) ... @todo
    • batchSize (Number) ... @todo
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.count(ns, opts, fn)

production

Run a count on db.collection.

Parameters
  • ns (required, String) ... A namespace string, eg #{database_name}.#{collection_name}

  • opts (optional, Object) ...

    • query (Object) ... default {}
    • limit (Number) ... default 10, max 200
    • skip (Number) ... default 0
    • explain (Boolean) ... Return explain instead of documents default false
    • sort (Object) ... {key: (1|-1)} spec default null
    • fields (Object) ... @todo
    • options (Object) ... @todo
    • batchSize (Number) ... @todo
  • fn (optional, Function) ... A response callback (err, data)

mongoscope.aggregate(ns, pipeline, opts, fn)

development

Run an aggregation pipeline on db.collection.

Examples
Parameters
  • ns (required, String) ... A namespace string, eg #{database_name}.#{collection_name}

  • pipeline (required, Array)

  • opts (optional, Object) ...

    • explain (Boolean) ... @todo
    • allowDiskUse (Boolean) ... @todo
    • cursor (Object) ... @todo
  • fn (required, Function) ... A response callback (err, data)

mongoscope.sample(ns, opts, fn)

development

Use resevoir sampling to get a slice of documents from a collection efficiently.

Parameters
  • ns (required, String) ... A namespace string, eg #{database_name}.#{collection_name}

  • opts (optional, Object) ...

    • size (Number) ... The number of samples to obtain default 5
    • query (Object) ... Restrict the sample to a subset default {}
  • fn (required, Function) ... A response callback (err, data)

mongoscope.random(ns, opts, fn)

development

Convenience to get 1 document via Client.prototype.sample.

Parameters
  • ns (required, String) ... A namespace string, eg #{database_name}.#{collection_name}

  • opts (optional, Object) ...

    • query (Object) ... Restrict the sample to a subset default {}
  • fn (required, Function) ... A response callback (err, data)

mongoscope.workingSet(opts, fn)

prototype

Working set size estimator.

Parameters
  • opts (optional, Object)
  • fn (required, Function) ... A response callback (err, data)