Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-profiler

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-profiler - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

__tests__/lib/__snapshots__/profiler.js.snap

7

.eslintrc.js

@@ -13,4 +13,7 @@ module.exports = {

globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
jest: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly'
},

@@ -17,0 +20,0 @@ parserOptions: {

@@ -1,1 +0,12 @@

module.exports = require('./lib/core');
const Profiler = require('./lib/profiler');
module.exports = options => {
const profiler = new Profiler(options);
return schema => {
schema.pre('find', profiler.preFunction);
schema.pre('findOne', profiler.preFunction);
schema.post('find', profiler.postFunction);
schema.post('findOne', profiler.postFunction);
};
};
{
"name": "mongoose-profiler",
"version": "0.0.2",
"version": "0.1.0",
"description": "A performance tuning tool for Mongoose.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "./node_modules/jest/bin/jest.js --coverage",
"coveralls": "./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info"
},

@@ -23,7 +24,10 @@ "repository": {

"devDependencies": {
"coveralls": "3.0.3",
"eslint": "5.15.3",
"eslint-config-xo": "0.26.0",
"eslint-config-xo-space": "0.21.0",
"jest": "24.7.1",
"mockdate": "2.0.2",
"npm-check-updates": "3.1.7"
}
}
# mongoose-profiler
[![npm version](https://badge.fury.io/js/mongoose-profiler.svg)](https://www.npmjs.com/package/mongoose-profiler)
[![Coverage Status](https://coveralls.io/repos/github/kelp404/mongoose-profiler/badge.svg?branch=master&a)](https://coveralls.io/github/kelp404/mongoose-profiler?branch=master)
[![CircleCI](https://circleci.com/gh/kelp404/mongoose-profiler.svg?style=svg)](https://circleci.com/gh/kelp404/mongoose-profiler)
This is a [mongoose](https://mongoosejs.com) plugin for tuning performance.

@@ -17,2 +21,3 @@ It will show the [explain results](https://docs.mongodb.com/manual/reference/explain-results/) on the console when the query is slow.

When you execute this query without the index then you will get some messages on the console.
```js

@@ -24,3 +29,2 @@ ProductModel

```
When you execute this query without the index then you will get some messages on the console.
```base

@@ -93,4 +97,3 @@ Mongoose: 64ms Products.find({ state: 'active', owner: { '$in': [ ObjectId("5c9d9428e7462d3d989cb69b"), ObjectId("5c9d95acea5c9b4036d97c88") ] } }, { skip: 0, limit: 100 })

## Document
### Options
## mongooseProfiler()
```js

@@ -105,7 +108,8 @@ const mongooseProfiler = require('mongoose-profiler');

```
### Options
Name | Type | Default | Description
:-----------------:|:-----------:|:--------:|:-----------:
:------------------|:------------|:---------|:------------
isAlwaysShowQuery | Boolean | true |
duration | Number | 1000ms | Show the explain result when the query took more than this time.<br/>(The time from `pre()` to `post()`.)
totalDocsExamined | Number | | Show the explain result when the query examined documents more than this number.
level | String | COLLSCAN |ALL: Show the explain result of all queries.<br/>COLLSCAN: Show the explain result when the mongodb scan collections.
level | String | COLLSCAN |`ALL`: Show the explain result of all queries.<br/>`COLLSCAN`: Show the explain result when the mongodb scan collections.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc