You manage a Cloud Firestore database in Native mode. Each document in the incidents collection contains a timestamp field createdAt and an array field tags. Operations wants to display the 20 most recent incidents whose tags array contains either "urgent" or "high". Which Node.js Admin SDK query retrieves the correct documents in a single request?
The array-contains-any operator matches documents whose array field contains any of the values in the supplied list. Combining it with orderBy('createdAt', 'desc') and limit(20) returns the most recent 20 matching documents in one network round-trip.
Using two separate array-contains filters on the same field is not allowed in a single Firestore query. The in operator (and simple equality) compare the entire field value, so they only work when the field itself equals one of the listed strings rather than when the value appears inside an array. Therefore, only the option that uses array-contains-any meets all requirements.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the difference between 'array-contains' and 'array-contains-any' in Firestore?
Open an interactive chat with Bash
Why can't you use two 'array-contains' filters for querying the same field in Firestore?
Open an interactive chat with Bash
What is the purpose of 'orderBy' and 'limit' in Firestore queries?
Open an interactive chat with Bash
What does the 'array-contains-any' operator do in Firestore?
Open an interactive chat with Bash
Why can't you use two 'array-contains' filters in the same Firestore query?
Open an interactive chat with Bash
How does the 'orderBy' method work with Firestore queries?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Ensuring successful operation of a cloud solution
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .