Firebase Query with where

Viewed 22

How can I do query with where in firebase? For example I want to access to the nameL of locationEvent in the estructure of the photo.

I am using flutter to code my app.

firebase photo

1 Answers

As shown in the doc, you can do as follows:

// Create a reference to the collection
final collectionRef = db.collection('collectionName');

// Create a query against the collection.
final query = collectionRef.where('locationEvent.${nameL}', isEqualTo: 'jkn');

// Execute the query
query.get().then(
  (res) => print("Successfully completed"),
  onError: (e) => print("Error completing: $e"),
);
Related