mongodb-index-inspector
v1.0.12
Published
Log warnings about the missing MongoDB indexes.
Downloads
19
Maintainers
Readme
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 [email protected] --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