Complete the code to order documents by the field 'score' in ascending order.
db.collection('games').orderBy('[1]').get()
The orderBy method sorts documents by the specified field. Here, 'score' is the field to order by.
Complete the code to order documents by 'date' in descending order.
db.collection('games').orderBy('date', '[1]').get()
The second argument to orderBy specifies the direction. Use 'desc' for descending order.
Fix the error in the code to order by 'level' ascending.
db.collection('games').orderBy([1]).get()
The orderBy method takes the field name as a string. To order ascending, just provide the field name.
Fill both blanks to order by 'score' descending and then by 'date' ascending.
db.collection('games').orderBy('[1]', '[2]').orderBy('date', 'asc').get()
The first orderBy orders by 'score' descending. The second orders by 'date' ascending.
Fill all three blanks to order by 'level' descending, then by 'score' ascending, and finally by 'date' ascending.
db.collection('games').orderBy('[1]', '[2]').orderBy('[3]', 'asc').orderBy('date', 'asc').get()
The first orderBy sorts by 'level' descending. The second orderBy sorts by 'score' ascending. The third orderBy sorts by 'date' ascending.