Firebase Cloud Firestore ORM to ease common tasks such as creating, finding, updating and deleting documents.
Please note: This is an unofficial Firestore package, part of the instant
suite of tools.
You can install this package using npm:
$ npm install instant-firestore
Here is a quick example to get you started:
ES Modules
import { FirestoreRepository } from 'instant-firestore';
// Pass your firestore instance and a collection reference to the constructor
const fr = new FirestoreRepository(db, db.collection('your-collection-name'));
const data await = fr.findById('12345');
console.log(data);
CommonJS Modules
var FirestoreRepository = require('instant-firestore').FirestoreRepository;
// Pass your firestore instance and a collection reference to the constructor
var fr = new FirestoreRepository(db, db.collection('your-collection-name'));
fr.findById('12345').then(function(data) {
console.log(data);
});
Create a Firestore document.
attributes (Object)
: The document attributes.
options (Object):
Options.
(Object)
: The serialized document
We'd greatly appreciate any contribution you make.