# ccd-mongo

> Mongo service base class for CCD based on mongoose

Latest version **1.0.4** (published 2017-06-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install ccd-mongo
pnpm add ccd-mongo
yarn add ccd-mongo
bun add ccd-mongo
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2017-06-21 |
| First published | 2016-11-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Code Chemistry |
| Maintainers | codechem, roshan931 |
| Keywords | ccd, typescript, mongo, mongoose, db, service, node.js |

## Links

- npm: https://www.npmjs.com/package/ccd-mongo
- Repository: https://github.com/codechem/ccd-mongo
- Homepage: https://github.com/codechem/ccd-mongo#readme
- Issues: https://github.com/codechem/ccd-mongo/issues
- npm.io page: https://npm.io/package/ccd-mongo

## Dependencies (1)

- [ccd](https://npm.io/package/ccd.md) >=1.0.15

## 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.4 (latest) — 2017-06-21
- 1.0.3 — 2016-11-11
- 1.0.2 — 2016-11-11
- 1.0.1 — 2016-11-11

## README

[![Build Status](https://travis-ci.org/codechem/ccd-mongo.svg?branch=master)](https://travis-ci.org/codechem/ccd-mongo)

<div style="display:flex;align-items:center;>
<label style="height:30px;height: 40px; line-height: 30px; padding-right: 20px;">
    
</label>
<a href="https://github.com/codechem/ccd" style="padding-right: 20px;display:flex;align-items:center;"">
    <label style="height:30px;height: 40px; line-height: 30px;padding-right: 10px;">
        <b>Mongoose integration in CCD Framework</b>
    </label>
    <img style="height:60px" src="https://raw.githubusercontent.com/codechem/ccd-snippets/master/images/ccdLogo.png"></img>
</a>
</div>

## CCD-MONGO

Mongoose based service and CCD controller
Also implements the basic CRUD methods

### **Example** ```CCControllerService<T>```
```typescript
...imports and setup

interface User extends mongoose.Document{
    Username:string
}

class UserCtrl extends CCServiceController<User>{
    @post('/login')    
    login(req, res){
        //yes, that simple, 
        //model is regulat mongoose model
        return this.model.findOne(req.body); 
    }
}
//the mongoose model needs to be defined
mongoose.Model<User>('User', new mongoose.Schema({
    Username:String
});

app.use('/', new UserCtrl('User').router);
app.listen(3000);
```

### Note

If you like to be more structured and have the db methods in a separate class then you can use the ```CCService<T>``` class for that.

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