books_ref pointing to the 'books' collection.search_genre with the exact string value 'fiction'.query_ref that uses where with array-contains to find books where the genres array contains search_genre.query_ref using get().books_ref pointing to the 'books' collection.search_genre with the exact string value 'fiction'.query_ref that uses where with array-contains to find books where the genres array contains search_genre.query_ref using get().books_ref that points to the collection named 'books'.Use firestore.collection('books') to get the collection reference.
search_genre and set it to the string 'fiction'.Use const search_genre = 'fiction'; to create the variable.
query_ref that uses books_ref.where with the field 'genres', the operator 'array-contains', and the value search_genre.Use books_ref.where('genres', 'array-contains', search_genre) to create the query.
query_ref by calling get() and assign it to a variable called query_snapshot.Use await query_ref.get() to get the documents.
What does the array-contains query operator do in Firebase Firestore?
array-containsarray-contains matches arrays including a value.Which of the following is the correct syntax to query documents where the tags array contains the value "urgent"?
const query = firestore.collection('tasks').where(____);.where("field", "array-contains", value). "tags", "array-contains", "urgent" matches this exactly.Given the following documents in a Firestore collection projects:
[{ id: 1, members: ["alice", "bob"] }, { id: 2, members: ["carol"] }, { id: 3, members: ["bob", "dave"] }]What will the query firestore.collection('projects').where('members', 'array-contains', 'bob').get() return?
What is wrong with this Firestore query?
firestore.collection('orders').where('items', 'array-contains', ['apple', 'banana'])The items field is an array of strings.
You want to find all documents in the events collection where the attendees array contains both "john" and "jane". Which approach is correct?
Pass the test and this pattern moves unknown