# cascade-config-mongodb

> mongodb extension for cascade-config

Latest version **1.2.1** (published 2026-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install cascade-config-mongodb
pnpm add cascade-config-mongodb
yarn add cascade-config-mongodb
bun add cascade-config-mongodb
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2026-04-21 |
| First published | 2018-12-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jose Luis Martinez Juan |
| Maintainers | pepmartinez |
| Keywords | configuration, hierarchy, mongodb |

## Links

- npm: https://www.npmjs.com/package/cascade-config-mongodb
- Repository: https://github.com/pepmartinez/cascade-config-mongodb
- Issues: https://github.com/pepmartinez/cascade-config-mongodb/issues
- npm.io page: https://npm.io/package/cascade-config-mongodb

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ~4.18.1
- [mongodb](https://npm.io/package/mongodb.md) ~4.17.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.2.1 (latest) — 2026-04-21
- 1.2.0 — 2025-10-29
- 1.1.4 — 2025-08-19
- 1.1.3 — 2024-08-03
- 1.1.2 — 2024-06-06
- 1.1.1 — 2023-08-31
- 1.1.0 — 2023-04-16
- 1.0.6 — 2022-03-22
- 1.0.5 — 2021-05-13
- 1.0.4 — 2020-09-05
- 1.0.3 — 2020-07-17
- 1.0.2 — 2019-07-14
- 1.0.1 — 2018-12-26
- 1.0.0 — 2018-12-26

## README

# cascade-config-mongodb
extension loader to cascade-config to read from mongodb

## Deprecation notice
Starting with v1.2.0, it will only work with `cascade-config` versions 1.9.0 and onwards

## Quick Start
`cascade-config-mongodb` adds a loader to `cascade-config` to allow reading from mongodb databases:

```javascript
var CC_base = require('cascade-config');
var CC_mongodb = require ('cascade-config-mongodb');
var CC = CC_mongodb (CC_base);

var config = new CC();

config
.obj ({cc: {n: 'ooo'}, x: 0})
.mongodb({ 
  url: 'mongodb://{env}-config.server.com', 
  db: 'config_database_{env}', 
  coll: 'config_{env}_coll', 
  id: 'abcdef-{env}')
.done(function (err, cfg) {
  ...
});
```

## API
* `.mongodb (opts)`: reads an object from a mongodb database, specified by mongodb url, database, collection and _id value. All 4 support variable substitution. Options are:
  * `url`: mongodb url (as supported by mongodb driver v3)
  * `db`: database to use
  * `coll`: collection to use
  * `id`: value of `_id` to seek within the collection. The `_id` itself is deleted from the returned object

# Variable expansion
As it happens with standard loaders in `cascade-config` read objects from mongodb are then subject to variable expansion using so-far read config; also, config read by this loader can be user as source for variable expansion on further stages

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