npm.io
1.0.3 • Published 7 years ago

instant-firestore-utils

Licence
MIT
Version
1.0.3
Deps
1
Size
33 kB
Vulns
0
Weekly
0
Stars
1

Instant Firestore Utils

Lightweight Firebase Firestore utility library.

Please note: Although this package can be utilized with raw Firestore Documents and Collections, it may be easier to use the instant-firestore ORM depending on your requirements.

Table of Contents

Installation

You can install this package using npm:

$ npm install instant-firestore-utils

Usage

Here is a quick example to get you started:

ES Modules

import { getDocument } from 'instant-firestore-utils';

const test = async () => {
  const doc = await getDocument(db.collection('countries')); // Assumes db is a Firebase Firestore reference
  console.log(doc);
};

CommonJS Modules

var getDocument = require('instant-firestore-utils').getDocument;

getDocument(db.collection('countries')).then(function(doc) {
  console.log(doc);
});

API

getDocument
getCollection
getSubCollection
serializeDocument
serializeSnapshot
populate
populateReference
populatePath
populateSubcollection
deserialize
deserializePath

Contributing

We'd greatly appreciate any contribution you make.

License

MIT

Keywords