Bird
0
0

Which of the following is the correct Firestore query syntax to filter documents where 'age' is greater than 30?

easy📝 Syntax Q3 of 15
GCP - Cloud Firestore and Bigtable
Which of the following is the correct Firestore query syntax to filter documents where 'age' is greater than 30?
Adb.collection('users').filter('age', '>', 30)
Bdb.collection('users').query('age', '>', 30)
Cdb.collection('users').where('age', '>', 30)
Ddb.collection('users').find('age', '>', 30)
Step-by-Step Solution
Solution:
  1. Step 1: Recall Firestore query syntax

    Firestore uses .where(field, operator, value) to filter documents.
  2. Step 2: Match syntax to options

    Only db.collection('users').where('age', '>', 30) uses .where with correct parameters.
  3. Final Answer:

    db.collection('users').where('age', '>', 30) -> Option C
  4. Quick Check:

    Use .where(field, operator, value) for filters [OK]
Quick Trick: Use .where() for filtering in Firestore queries [OK]
Common Mistakes:
  • Using .filter or .find which are invalid
  • Incorrect method names for queries
  • Missing parameters in .where()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes