Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rouanw/index-mixer
Given a MongoDB query, index mixer will return an array of all possible indexes that could potentially serve that query
https://github.com/rouanw/index-mixer
Last synced: 4 days ago
JSON representation
Given a MongoDB query, index mixer will return an array of all possible indexes that could potentially serve that query
- Host: GitHub
- URL: https://github.com/rouanw/index-mixer
- Owner: rouanw
- Created: 2017-08-03T10:09:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-18T19:38:30.000Z (over 1 year ago)
- Last Synced: 2024-02-02T15:08:37.346Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Index mixer
Given a MongoDB query, index mixer will return an array of all possible indexes that could potentially serve that query.
## Installation
```sh
npm install --save index-mixer
```## Usage
```js
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