google-cloud-firestore

Firestore security rules, nested field

和自甴很熟 提交于 2021-01-28 10:13:50
问题 Our database structure looks like that: trips 12345 toArea radius: 150 name: "citycenter" 54321 toArea radius: 250 name: "main street" We tried to create some rules for read from document: match /chats/{trip} { match /messages/{message} { allow read, write: if get(/databases/$(database)/documents/trips/$(trip)).data.toArea != null } } It's works fine but next rules doesn't works: allow read, write: if get(/databases/$(database)/documents/trips/$(trip)).data.toArea != null allow read, write:

Does Firebase Admin SDK perform any caching?

人走茶凉 提交于 2021-01-28 10:08:18
问题 I've been using firebase with cloud functions recently and this question popped into my mind. If in my cloud function, using the Firebase Admin SDK, perform multiple reads to the same document in a single function call, will it count as multiple reads in the database or will it cache the data? Example: await admin.firestore().collection("users").doc("user_id_here").get(); await admin.firestore().collection("users").doc("user_id_here").get(); await admin.firestore().collection("users").doc(

Firestore one range query with order by on different field

我们两清 提交于 2021-01-28 09:49:24
问题 I have the following Collection / Documents Location Collection { "geoHash" : "wwscjrm3nu01", "timeStamp" : "March 25, 2020 at 1:07:38 PM UTC-4" } { "geoHash" : "wwscjrm2wc2h", "timeStamp" : "March 25, 2020 at 2:07:38 PM UTC-4" } please replace the GeoHashs# with the example above So, I was trying to query a range of those GeoHashs with ordering them by timestamp "DESC", Like the following db.collection('location') .where('geoHash', '>=', 'wwkxt4kxmmvk') .where('geoHash', '<=', 'wwt4vsn22peq'

Firestore one range query with order by on different field

本小妞迷上赌 提交于 2021-01-28 09:47:18
问题 I have the following Collection / Documents Location Collection { "geoHash" : "wwscjrm3nu01", "timeStamp" : "March 25, 2020 at 1:07:38 PM UTC-4" } { "geoHash" : "wwscjrm2wc2h", "timeStamp" : "March 25, 2020 at 2:07:38 PM UTC-4" } please replace the GeoHashs# with the example above So, I was trying to query a range of those GeoHashs with ordering them by timestamp "DESC", Like the following db.collection('location') .where('geoHash', '>=', 'wwkxt4kxmmvk') .where('geoHash', '<=', 'wwt4vsn22peq'

How to get the string value of QR code and store it into firebase so it links to specific user

爷,独闯天下 提交于 2021-01-28 09:15:59
问题 I'm trying to make a loyalty app by QR scan and unsure how I can get the string value of the QR code generated to each user and then store it in firebase so that it links to a specific user then update the number of times the user's QR code has been scanned in a sub-collection linked to the user collection. QrImage( data: '${user?.uid}', version: QrVersions.auto, size: 300, errorStateBuilder: (cxt, err) { return Container( child: Center( child: Text('Error', textAlign: TextAlign.center, style

FirestoreRecyclerAdapter not updating views

北城以北 提交于 2021-01-28 09:12:43
问题 I`m using FirestoreRecyclerAdapter and faced with the problem. Query query = db .collection(SOME_COLLECTION) .whereEqualTo("key", key) .orderBy("dueDate"); If I put orderBy, data loaded just first time. Real time updates not working. I tried putting orderBy at the end, as well as changing ordering fields. If I remove orderBy, all works well. But no ordering. According to documentation it should work when not using range comparison. Any ideas? Updated. Here is adapter options.

Refresh to load new data and scroll to paginate data Flutter Firestore

江枫思渺然 提交于 2021-01-28 08:59:28
问题 I have a Firestore collection called 'Feeds' that contains a list of posts for a given user's feed (like Instagram). When the view loads, I call a future and order by time var userPostsDocumentSnapshot = await _feeds .document(userUid) .collection(items) .orderBy('postDateTime', descending: true) .getDocuments(); I was initially using a stream, but when new data is added to the user's feed, I don't want it to show automatically, I want a pull-down-to-load new data. However, I also want to

Can I query a nested document value in firestore?

筅森魡賤 提交于 2021-01-28 08:48:51
问题 I'm looking to do a search on the following data in firestore: Collection->Document->{date{month:10,year:2017}} var ref = db.collection(collection).doc(document) ref.where('date.month', '==', 10).get().then(doc=>{ if (!doc.exists) { console.log('No such document!'); } else { console.log('Document data:', doc.data()); } }).catch(err => { console.log('Error getting document', err); }); The above pseudo code does not work. Any suggestions? 回答1: It looks like you are querying a document: var ref

How to Show native ads in listview.builder in flutter with pagination?

China☆狼群 提交于 2021-01-28 08:29:05
问题 I am using below code to retrieve list in flutter application using pagination with firestore as database, which working fine. I am referring flutter_native_admob dependency for the native ads. but I am not able to get the idea how I can implement it in a listview.builder and at the same time I need to implement the pagination. Like in instagram, as after certain number of posts, the native ad shows up, I need to show the add in similar fashion. How is that possible? _getProducts() async {

Firestore Array of Document References

廉价感情. 提交于 2021-01-28 08:19:35
问题 I have the following structure of my Firestore database: products:{ // Collection procuct_1: { // Document title:"", url:"" videos:{ // Collection video_1:{ // Document title:"", products:{ // Array of references 0: "/products/product_1, 1: "/products/product_2 I would like to be able from Array field in Videos Collection to get Document References to Products collection in order to get values of some fields of this collection (ex. title of product). For the moment I use this code: