Miss any of our Open RFC calls?Watch the recordings here! »

index-mixer

0.2.1 • Public • Published

Index mixer

Given a MongoDB query, index mixer will return an array of all possible indexes that could potentially serve that query.

Installation

npm install --save index-mixer

Usage

const indexMixer = require('index-mixer');
 
indexMixer({ 'name.first': 'Richard', 'vegan': true });
 
/* [{ 'name.first': 1 },
    { vegan: 1 },
    { 'name.first': 1, vegan: 1 },
    { vegan: 1, 'name.first': 1 }] */

Note

index-mixer currently only returns ascending indexes (e.g. { name: 1 }). Open a PR if you'd like to return descending indexes (e.g. { name: -1 }) too.

License

MIT

Keywords

none

Install

npm i index-mixer

DownloadsWeekly Downloads

4

Version

0.2.1

License

MIT

Unpacked Size

2.84 kB

Total Files

4

Last publish

Collaborators

  • avatar