# build-db-index

> build db index by config

Latest version **1.0.1** (published 2018-04-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install build-db-index
pnpm add build-db-index
yarn add build-db-index
bun add build-db-index
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-04-04 |
| First published | 2018-03-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | abiu |
| Maintainers | abiu |
| Keywords | db, index |

## Links

- npm: https://www.npmjs.com/package/build-db-index
- Repository: https://github.com/abiuDoIT/buildDbIndex
- Homepage: https://github.com/abiuDoIT/buildDbIndex#readme
- Issues: https://github.com/abiuDoIT/buildDbIndex/issues
- npm.io page: https://npm.io/package/build-db-index

## Dependencies (2)

- [mongodb](https://npm.io/package/mongodb.md) ^3.0.5
- [@types/node](https://npm.io/package/@types/node.md) ^9.6.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [@temporal-architect/claude-plugin](https://npm.io/package/@temporal-architect/claude-plugin.md) — 335 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-04-04
- 1.0.0 — 2018-03-29

## README

## what to handle
build mongodb indexes by config file
## how to use
`npm install build-db-index`
```
async function build() {
    await setIndex({uri:"mongodb://127.0.0.1:27017",db:"test"},
    {
        offer:[
            {key:{offer_id:1,time:1}},
            {key:{ttl:1},options:{expireAfterSeconds:2600}}
        ],
        user:[{key:{userid:1},options:{unique:true}}]
    })
}

build().catch(console.error);
```
### excuted build(),the db 'test' will build the indexes of collection offer and user,
### and drop all indexes( of all collections defined in config) that not defined in config.
### If index exists(key and options are both same ),it will not take time to rebuild it.

---
_Source: https://npm.io/package/build-db-index · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
