# @zwzn/firestore-orm

> Firestore ORM is a class based orm on top of Google Cloud Firestore inspired by Laravel's Eloquent ORM.

Latest version **0.5.0** (published 2020-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @zwzn/firestore-orm
pnpm add @zwzn/firestore-orm
yarn add @zwzn/firestore-orm
bun add @zwzn/firestore-orm
```

## Health

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

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

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2020-03-05 |
| First published | 2020-02-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 32.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Adam Bibby |
| Maintainers | zwzn |

## Links

- npm: https://www.npmjs.com/package/@zwzn/firestore-orm
- Repository: https://github.com/zwzn/firestore-orm
- Homepage: https://github.com/zwzn/firestore-orm#readme
- Issues: https://github.com/zwzn/firestore-orm/issues
- npm.io page: https://npm.io/package/@zwzn/firestore-orm

## Recent versions

- 0.5.0 (latest) — 2020-03-05
- 0.4.0 — 2020-02-25
- 0.3.1 — 2020-02-24
- 0.3.0 — 2020-02-24
- 0.2.5 — 2020-02-20
- 0.2.4 — 2020-02-20
- 0.2.3 — 2020-02-20
- 0.2.2 — 2020-02-20
- 0.2.0 — 2020-02-20
- 0.1.1 — 2020-02-13
- 0.1.0 — 2020-02-13

## README

# Firestore ORM

Firestore ORM is a class based orm on top of Google Cloud Firestore inspired by
Laravel's Eloquent ORM.

## Basic Example

``` ts
import { Model } from '@zwzn/firestore-orm'
import firebase from 'firebase/app'

class Foo extends Model {
    collection = firebase.firestore().collection('foo')

    @Model.field()
    bar: string = ''
}

const f1 = new Foo()
f1.bar = 'baz'

console.log(f1.toJSON()) // { id: undefined, bar: 'baz' }
await f1.save()
console.log(f1.toJSON()) // { id: <random id>, bar: 'baz' }

const f2 = await Foo.find(f.id)
console.log(f2.toJSON()) // { id: <random id>, bar: 'baz' }
```

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