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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mongo-tail-queries

v1.0.2

Published

Tail all the mongo queries

Readme

Description

This package allows you to tail all queries hitting a Mongo database. You'll see performance metrics associated with each query.

> mongo-tail-queries my_project -l 2
2018-12-03T21:58:23.153Z [UPDATE] users {"$and":[{"services.password.reset.reason":"enroll"},{"$or":[{"services.password.reset.when":{"$lt":"2018-11-03T21:58:23.149Z"}},{"services.password.reset.when":{"$lt":1541282303149}}]}],"_id":{"$in":[]}} {"$unset":{"services.password.reset":""}} : 0 updated. 0 examined. 0 millis.
2018-12-03T21:58:38.915Z [QUERY] users {"_id":"zmL8fgYCci3qfirbr"} : 1 returned. 1 examined. 0 millis.
2018-12-03T21:58:38.917Z [QUERY] chat_rooms {"_id":{"$in":[]},"members":"zmL8fgYCci3qfirbr","messages.sent":{"$gt":"2018-12-03T21:36:37.000Z"}} : 0 returned. 0 examined. 0 millis.
2018-12-03T21:59:25.185Z [COUNT] billing_history {} : 0 examined. 0 millis.
2018-12-03T21:59:32.091Z [QUERY] billing_history {} : 10 returned. 10 examined. 0 millis.
2018-12-03T21:59:32.094Z [QUERY] billing_history {"_id":{"$in":["B9cC9wPCANRcSM2fG","3NFtqgsDRdfEH4SWT","26SdMWXnokzPL7AiZ","TTsR5MXtrxnnbekci","Y6NGEBFwQWMhsgeeH","AhKfdLdQrTTouagvj","2dLEcfcDC8t6jrLk9","LqRCoBpuZDZ6iXeeH","vf3sCSZfisNPbfGx7","havDEy5egYR2cvReS"]}} : 10 returned. 10 examined. 0 millis.
2018-12-03T21:59:32.104Z [REMOVE] billing_history {}: 10 deleted. 10 examined. 0 millis.
2018-12-03T21:59:38.915Z [QUERY] users {"_id":"zmL8fgYCci3qfirbr"} : 1 returned. 1 examined. 0 millis.

Installation

This will add the package as a CLI: npm install -g mongo-tail-queries

How it works

If you set up profiling, Mongo will log queries and metadata to a capped collection called "system.profile". This package opens a tailable cursor on this collection, and prints the results as they come

Running

Command to run

node mongo-tail-queries [database] [options]

or (if installed as CLI):

mongo-tail-queries [database] [options]

example: node mongo-tail-queries 192.0.0.1:30001/my_project --authDB 'admin' --username 'tom' --password 'jerry' -l 2

Database

database argument should be formatted like [ip]:[port]/[db_name]. You can leave out the [ip]:[port] prefix to tail the db_name running locally (on localhost:27017).

Options

| Argument | Details | |----------------------|-------------------------------------------------------------------------------| | --profilelevel or -l | Sets the profiling level. 0 is for none; 1 is for slow queries; 2 is for all. | | --slowms or -s | The cutoff for slow queries (if using profiling level 1). Default is 100ms. | | --authDB | the auth database to use to authenticate the user. | | --username | username for db access. | | --password | passsword for db access. |