Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To obtain an element from a Firestore array with a unique value, you can use the array-contains query. The array-contains query searches for a specific element in an array field.

Here is an example of a query to get an element from a Firestore array with a unique value of myValue:

db.collection('myCollection').where('myArray', 'array_contains', 'myValue').get()

This query will return all documents in the myCollection collection where the myArray field contains the value myValue. If there are multiple elements in the array with the value myValue, you can use additional query conditions to narrow down the result.