mongodb-index-inspector
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

MongoDB Index Inspector

Log warnings about the missing MongoDB indexes.

Support

MongoDB Node.JS Driver 2.2

MongoDB 3.4

Installation

npm install mongodb-index-inspector --save
npm install mongodb@2.2 --save

Usage

TypeScript

import { MongoDBIndexInspector, MongoDBFilter } from 'mongodb-index-inspector';

async function inspect (): void {
    const filter: MongoDBFilter = { username: 'davkorss', password: 'The safest password in the world :3' };
    const inspector: MongoDBIndexInspector = new MongoDBIndexInspector(collection);
    await inspector.inspect(filter);
}

inspect();
If the index does not exist, output should be:
'Missing index from filter {"username":"davkorss","password":"The safest password in the world :3"}'

JavaScript

const MongoDBIndexInspector = require('mongodb-index-inspector').MongoDBIndexInspector

async function inspect () {
    const filter = { username: 'davkorss', password: 'The safest password in the world :3' }
    const inspector = new MongoDBIndexInspector(collection)
    await inspector.inspect(filter)
}

inspect()
If the index does not exist, output should be:
'Missing index from filter {"username":"davkorss","password":"The safest password in the world :3"}'

Test

npm test

Package Sidebar

Install

npm i mongodb-index-inspector

Weekly Downloads

0

Version

1.0.12

License

MIT

Unpacked Size

6.58 kB

Total Files

8

Last publish

Collaborators

  • davkorss