# loopback-denormalize

> Module for denormalizing association attributes in loopback mongodb models

Latest version **0.0.6** (published 2015-12-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install loopback-denormalize
pnpm add loopback-denormalize
yarn add loopback-denormalize
bun add loopback-denormalize
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2015-12-07 |
| First published | 2015-09-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jean Baptiste Marchetti |
| Maintainers | jbmarchetti |
| Keywords | loopback, mongodb, nodeJs |

## Links

- npm: https://www.npmjs.com/package/loopback-denormalize
- Repository: https://github.com/jbmarchetti/loopback-denormalize
- Issues: https://github.com/jbmarchetti/loopback-denormalize/issues
- npm.io page: https://npm.io/package/loopback-denormalize

## 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
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2015-12-07
- 0.0.5 — 2015-12-02
- 0.0.4 — 2015-11-25
- 0.0.3 — 2015-11-25
- 0.0.2 — 2015-09-23

## README

# loopback-denormalize
Module for denormalizing association attributes in loopback mongodb models


## Install
1. Add `"loopback-denormalize": "latest"` to your `package.json` file then run `npm install` OR run `npm install loopback-denormalize`
2. Set the module in your Entity.js

**Sample: Product with many tags and on category.**

     require('loopback-denormalize')(Product,
     {
        tags: { attributes: ['id', 'text'], type: 'hasMany' },
        category: { attributes: ['id', 'title'], type: 'hasOne' }
     });
3. See the results

**GET product.json**

     {
        id: ....,
        title: ....,
        _tags:[{ id:'dsgsdg', text:'tag1'}, { id:'fsfsffff', text:'tag2'}],
        _category:{ id:'dsgsdg', title:'My Category'}
     }

## Info

**Methods added to your entity**

1. Before Save observer who automatically denormalize fields
2. Refresh remote method `entities/denormalize/:id`

Sample: http://mysite/api/products/denormalize/565f69bbd3810ed01977cdf1.

Enjoy ;)

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