firestore-web-wrapper
v2.0.4
Published
an intuitive wrapper for firestore web CRUD, with a built in date_created, date_updated stamp
Downloads
14
Maintainers
Readme
fireStoreWeb
an intuitive wrapper for firestore web CRUD, with a built in date_created, date_updated, and doc_id field stamp
To start :
- set the config on the .env of your NEXT project
NEXT_PUBLIC_FIREBASE_WEB_API_KEY=
NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN=
NEXT_PUBLIC_FIREBASE_WEB_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_WEB_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_WEB_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_WEB_APP_ID=
To use :
docPath or colPath refer to document / collection path in string: example:
- colPath : "col_id/doc_id/col_id"
- docPath : "col_id/doc_id"
// for documents
FirebaseFirestore.createDoc(docPath || colPath:string, value)
// if arg is colPath: docId will be autogenerated and added to the document doc_id field
FirebaseFirestore.readDoc(docPath:string)
FirebaseFirestore.updateDoc(docPath:string, value)
FirebaseFirestore.deleteDoc(docPath:string, value)
// for collections
FirebaseFirestore.readCol(colPath:string, ...queryDef:string)
FirebaseFirestore.readColGroup(colPath:string, ...queryDef:string)
// for subscriptions
FirebaseFirestore.subscribeDoc(docPath:string, callbackFn:function)
FirebaseFirestore.subscribeCol(colPath:string, callbackFn:function, ...queryDef:string)
FirebaseFirestore.subscribeColGroup(colId:string, callbackFn:function, ...queryDef:string)