Relative Content

Tag Archive for fluttergoogle-cloud-firestore

Datetime saved as String in Firebase Firestore

I have quite a bit of data in Firebase Firestore that has its createdDate field saved as an ISO 8601 String (2024-05-15T18:08:30.825890). I did not have a need to perform any date comparisons before now but this is now a requirement for my application. The problem is, when I perform date comparison on the field for example var usersSnapshot = await FirebaseFirestore.instance.collection("users").where('dateCreated', isGreaterThan: dateCreated).get() I get 0 results. I suspect this is because the field in my firestore is saved with type string and not type timestamp.

Why firestore create dynamic index for all userId

return firestore .collection(‘chatrooms’) .where(‘participants’, arrayContains: userId) .where(‘chatType’, isEqualTo: ‘friend’) .where(‘visibility.$userId.visible’, isEqualTo: true) .orderBy(‘lastMessageTime.$userId’, descending: true) .snapshots() and now its creating the composite index like this. participants Arrays chatType Ascending visibility.8YvAhlkrD6Qzcu3XgXTdJxInghF2.visible Ascending lastMessageTime.8YvAhlkrD6Qzcu3XgXTdJxInghF2 Descending __name__ Descending i want that this will not happen. flutter google-cloud-firestore 1