0
0
Firebasecloud~10 mins

Ordering data in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to order data by a child key in Firebase Realtime Database.

Firebase
firebase.database().ref('users').orderByChild('[1]').on('value', snapshot => { console.log(snapshot.val()); });
Drag options to blanks, or click blank then click option'
Aset
Bpush
Cage
Dremove
Attempts:
3 left
💡 Hint
Common Mistakes
Using Firebase methods like 'push' or 'set' instead of a child key.
Leaving the orderByChild argument empty.
2fill in blank
medium

Complete the code to order data by key in Firebase Realtime Database.

Firebase
firebase.database().ref('messages').[1]().on('value', snapshot => { console.log(snapshot.val()); });
Drag options to blanks, or click blank then click option'
AorderByValue
BorderByKey
ClimitToFirst
DorderByChild
Attempts:
3 left
💡 Hint
Common Mistakes
Using orderByValue when ordering by keys is needed.
Confusing orderByChild with orderByKey.
3fill in blank
hard

Fix the error in the code to order data by value in Firebase Realtime Database.

Firebase
firebase.database().ref('scores').orderBy[1]().on('value', snapshot => { console.log(snapshot.val()); });
Drag options to blanks, or click blank then click option'
APush
BKey
CChild
DValue
Attempts:
3 left
💡 Hint
Common Mistakes
Using orderByChild or orderByKey when ordering by value is required.
Misspelling the method name.
4fill in blank
hard

Fill both blanks to order data by a child key and limit the results to the first 5 items.

Firebase
firebase.database().ref('products').[1]('price').[2](5).on('value', snapshot => { console.log(snapshot.val()); });
Drag options to blanks, or click blank then click option'
AorderByChild
BlimitToLast
ClimitToFirst
DorderByKey
Attempts:
3 left
💡 Hint
Common Mistakes
Using limitToLast instead of limitToFirst.
Ordering by key instead of child key.
5fill in blank
hard

Fill all three blanks to order data by a child key, start at a minimum value, and limit the results to 3 items.

Firebase
firebase.database().ref('events').[1]('date').startAt([2]).[3](3).on('value', snapshot => { console.log(snapshot.val()); });
Drag options to blanks, or click blank then click option'
AorderByChild
B'2023-01-01'
ClimitToFirst
DorderByKey
Attempts:
3 left
💡 Hint
Common Mistakes
Using orderByKey instead of orderByChild.
Not using quotes around the date string.
Using limitToLast instead of limitToFirst.