Firestore Sequelizer
Simple Firebase ORM
If you like to use Sequelize and use models in your backend projects try to use FirestoreSequelizer, some features:
- Create Models for your Collections;
- Create Single Doc Collections;
- Construct Select query's like Sequelize using where and orderBy;
- Default Attributes values for Collection Models;
- Attributes Validation;
- Sync command to update Collection Structure;
- Observators for model attribute change;
- Model Rollback;
- Subcollection Support;
Installation
To use lib just start your firebase-admin normally.
const admin = ;const firebaseSequelizer = ;admin;firebaseSequelizer;
Model Definition
const defineModel = ;const User = ;
CRUD operations
Create record;
let user = await User;
To find by id;
let user = await User;
To find all not admin users ordened by name using where and order;
let users = await User;
update user record using user instance;
let user = await User;username = "other name";await user;
Update user record using user static class;
await User;
Delete User record using user static class;
let user = await User;user;
Observables
const User = ;Userprototype //field = "name", value = "other name", data = rest of attributeslet user = await User;username = "other name";
Subcollections
const CashRegister = ;const User = ;let user = await User;let users = await User;useruseruser