google-cloud-firestore

How to set log level for Firestore?

喜夏-厌秋 提交于 2020-08-06 08:34:18
问题 How to set log level for Firestore? According to documentation here, i should use setLogLevel method but i can't see method at Firestore client objects, like FirestoreClient.getFirestore() . 回答1: For those who ended up here trying to change the log level for the JS Web SDK: firebase.firestore.setLogLevel("debug"); // "debug" | "error" | "silent" Notice the lack of () after firestore, as opposed to: firebase.firestore().settings(/*...*/) 回答2: Current versions for most environments documented

Regarding querying in cloud firestore

夙愿已清 提交于 2020-08-05 10:13:50
问题 I'm doing some research on cloud firestore using flutter. Currently I'm looking into querying in cloud firestore. I got a basic idea of how to query like say in the screenshot of the database given below : The 2nd (Some Dumb Shit) and 3rd (Some Good Shit) projects belong to the field "Hardware" ..... So if I want to search a project with respect to its field ..... I'll do something like this : databaseReference.collection("Projects").where("Field",isEqualTo: "Hardware") But say if I want to

Number values are saved as strings in firestore

泄露秘密 提交于 2020-08-05 06:20:06
问题 I use this function to send data to firestore exports.professional = functions.https.onRequest((request, response) => { const db = admin.firestore(); const userId: string = request.body['userId']; const qualificationId: number = request.body['qualificationId']; const occupationId: number = request.body['occupationId']; const employmentType: EMPLOYMENT_TYPE = request.body['employmentType']; const collegeOrInstitution: string = request.body['collegeOrInstitution']; return db.collection(

flutter firestore pagination using streambuilder

穿精又带淫゛_ 提交于 2020-08-05 05:54:38
问题 hello i am trying to use pagination in my list. and the list data is coming from firebase. i am not sure how to paginate data using stream builder. now i am doing the pagination by calling getdocuments in the didChangeDependencies() function. but after adding new data the list is not updated. if anyone can help then it will be great for me. here is what i am doing now.. didChangeDependencies() { super.didChangeDependencies(); getProducts(); _scrollController.addListener(() { double maxScroll

flutter firestore pagination using streambuilder

徘徊边缘 提交于 2020-08-05 05:54:05
问题 hello i am trying to use pagination in my list. and the list data is coming from firebase. i am not sure how to paginate data using stream builder. now i am doing the pagination by calling getdocuments in the didChangeDependencies() function. but after adding new data the list is not updated. if anyone can help then it will be great for me. here is what i am doing now.. didChangeDependencies() { super.didChangeDependencies(); getProducts(); _scrollController.addListener(() { double maxScroll

How to use multiple StreamBuilders in one ListView

和自甴很熟 提交于 2020-08-05 05:48:58
问题 So I am working on a project where I would like to have one List view that contains multiple streams of data. What I am looking for is something like this, but it all needs to be scrollable in one list view. The data stream I am receiving is from firebase and the variable myData is an instance of a firebase collection. I am able to build one list of a single stream so I know the instance is correct, I don't want to share it because the database rules are in a test mode at the moment. This

Update individual map in cloud firestore document

空扰寡人 提交于 2020-08-04 12:06:20
问题 Final Update I changed from using a transaction based on the answer below from andresmijares, to using set(). This now allows me to write the data to the DB. var gradeDocRef = db.collection("students").doc(studentId); console.log(gradeDocRef); var setWithMerge = gradeDocRef.set({ "UnitGrades": { [unitNo]: { "CG": CG, "PG": PG, "TG": TG } } }, { merge: true }); Edit I altered code for the transaction based on the comment from andresmijares below. transaction.set(gradeDocRef, {merge: true}, {

How to perform dynamic where queries with firestore and add indexes

£可爱£侵袭症+ 提交于 2020-08-04 05:14:50
问题 In my site i am conducting a survey like tests , each test has attendies sub collection look like this When someone finishes a test i also add their uid to completed field like i drawn in the box. Now i want to query tests based on status == completed . Here is what i tried this.completedModulesRef$ = this.afs.collection('tests', ref => ref.orderBy('moduleNum', 'desc') .where('completed.'+auth.uid+'.status','==','completed')); this.completedModules$ = this.completedModulesRef$.valueChanges();

Flutter Firestore add new document with Custom ID

扶醉桌前 提交于 2020-08-03 15:29:35
问题 How to add new document with custom id using Dart and Flutter? PS: I can add new document to collection but its id sets randomly, using this code postRef.add(data); which postRef is CollectionReference and data is Map<String, dynamic> 回答1: You can use set function instead of add . Here's full code: final CollectionReference postsRef = Firestore.instance.collection('/posts'); var postID = 1; Post post = new Post(postID, "title", "content"); Map<String, dynamic> postData = post.toJson(); await

Flutter Firestore add new document with Custom ID

别来无恙 提交于 2020-08-03 15:28:31
问题 How to add new document with custom id using Dart and Flutter? PS: I can add new document to collection but its id sets randomly, using this code postRef.add(data); which postRef is CollectionReference and data is Map<String, dynamic> 回答1: You can use set function instead of add . Here's full code: final CollectionReference postsRef = Firestore.instance.collection('/posts'); var postID = 1; Post post = new Post(postID, "title", "content"); Map<String, dynamic> postData = post.toJson(); await