google-cloud-firestore

Firestore Security Rules for Query with Array Contains

寵の児 提交于 2020-08-07 06:04:02
问题 I have a Flutter app in which users can make posts and tag the post as belonging to a group. Posts are stored in a global collection and each has a Post.groupId field: /posts/{postId} Based on my Firestore security rules and queries, users are only allow to read posts if they are in the group for which the post is tagged (i.e the posts's groupId field). Approved group users are stored in: /groups/{groupId}/users/{userId} I could query the posts from a particular user's group like: _firestore

Firestore Security Rules for Query with Array Contains

自古美人都是妖i 提交于 2020-08-07 06:00:00
问题 I have a Flutter app in which users can make posts and tag the post as belonging to a group. Posts are stored in a global collection and each has a Post.groupId field: /posts/{postId} Based on my Firestore security rules and queries, users are only allow to read posts if they are in the group for which the post is tagged (i.e the posts's groupId field). Approved group users are stored in: /groups/{groupId}/users/{userId} I could query the posts from a particular user's group like: _firestore

Handling Firebase Insufficient Permissions Errors in Flutter

天涯浪子 提交于 2020-08-07 05:24:17
问题 How can I handle insufficient permissions errors from firebase? I currently do this: try { DocumentSnapshot doc = await Firestore.instance.collection('SomeCollection').document('SomeDocument').get(); // Do something } catch (error) { print('Error: $error'); // Do something to show user } How ever I can't check for only Permission Errors. Sho how can I catch only insufficient permission errors? Also when should I use .catchError() , I tried this: DocumentSnapshot doc = await Firestore.instance

Handling Firebase Insufficient Permissions Errors in Flutter

人走茶凉 提交于 2020-08-07 05:24:08
问题 How can I handle insufficient permissions errors from firebase? I currently do this: try { DocumentSnapshot doc = await Firestore.instance.collection('SomeCollection').document('SomeDocument').get(); // Do something } catch (error) { print('Error: $error'); // Do something to show user } How ever I can't check for only Permission Errors. Sho how can I catch only insufficient permission errors? Also when should I use .catchError() , I tried this: DocumentSnapshot doc = await Firestore.instance

Handling Firebase Insufficient Permissions Errors in Flutter

北城以北 提交于 2020-08-07 05:24:07
问题 How can I handle insufficient permissions errors from firebase? I currently do this: try { DocumentSnapshot doc = await Firestore.instance.collection('SomeCollection').document('SomeDocument').get(); // Do something } catch (error) { print('Error: $error'); // Do something to show user } How ever I can't check for only Permission Errors. Sho how can I catch only insufficient permission errors? Also when should I use .catchError() , I tried this: DocumentSnapshot doc = await Firestore.instance

Firebase-functions-test “The default Firebase app does not exist.”

我的未来我决定 提交于 2020-08-07 03:25:17
问题 I've begun using the new firebase-functions-test testing SDK to unit test my Cloud Firestore functions. When I run my tests via npm test I am getting the following error: The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services My method is very similar to the makeUppercase method found within the quickstarts samples, and thus I have mainly copied the test from the test.js file. describe('updateActiveNotesCount', () => { // Test

Firebase-functions-test “The default Firebase app does not exist.”

只愿长相守 提交于 2020-08-07 03:24:19
问题 I've begun using the new firebase-functions-test testing SDK to unit test my Cloud Firestore functions. When I run my tests via npm test I am getting the following error: The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services My method is very similar to the makeUppercase method found within the quickstarts samples, and thus I have mainly copied the test from the test.js file. describe('updateActiveNotesCount', () => { // Test

How to get documents descending by DocumentID?

自闭症网瘾萝莉.ら 提交于 2020-08-07 01:29:54
问题 I am encountering the issue encountered in this question. Because the other question (and answer) is missing the point of solving the problem, I am writing a new question. orderBy(FieldPath.documentId(), 'desc') The above query will fail with the following error message: The query requires an index. You can create it here: ... As described in the other question, it is impossible to create that index because of the following error message: __name__ only indexes are not supported Because the

How to get documents descending by DocumentID?

醉酒当歌 提交于 2020-08-07 01:28:30
问题 I am encountering the issue encountered in this question. Because the other question (and answer) is missing the point of solving the problem, I am writing a new question. orderBy(FieldPath.documentId(), 'desc') The above query will fail with the following error message: The query requires an index. You can create it here: ... As described in the other question, it is impossible to create that index because of the following error message: __name__ only indexes are not supported Because the

How to set log level for Firestore?

霸气de小男生 提交于 2020-08-06 08:34:25
问题 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