0
0
MongoDBquery~10 mins

skip method for offset in MongoDB - Interactive Code Practice

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

Complete the code to skip the first 5 documents in the collection.

MongoDB
db.collection.find().[1](5)
Drag options to blanks, or click blank then click option'
Alimit
Bskip
Csort
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using limit instead of skip, which restricts the number of documents returned but does not skip.
Using sort or count which do not skip documents.
2fill in blank
medium

Complete the code to skip 10 documents and limit the result to 5 documents.

MongoDB
db.collection.find().skip(10).[1](5)
Drag options to blanks, or click blank then click option'
Asort
Bcount
Cskip
Dlimit
Attempts:
3 left
💡 Hint
Common Mistakes
Using skip again instead of limit, which would skip more documents instead of limiting.
Using count which returns a number, not documents.
3fill in blank
hard

Fix the error in the code to skip 3 documents correctly.

MongoDB
db.collection.find().[1](3)
Drag options to blanks, or click blank then click option'
Askip[]
Bskip.
Cskip
Dskip()
Attempts:
3 left
💡 Hint
Common Mistakes
Writing skip3 without parentheses causes a syntax error.
Using skip. or skip[] are invalid syntax.
4fill in blank
hard

Fill both blanks to skip 7 documents and sort by 'age' ascending.

MongoDB
db.collection.find().[1](7).[2]({ age: 1 })
Drag options to blanks, or click blank then click option'
Askip
Blimit
Csort
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using limit instead of skip for the first blank.
Using count instead of sort for the second blank.
5fill in blank
hard

Fill all three blanks to skip 4 documents, limit to 3 documents, and sort by 'name' descending.

MongoDB
db.collection.find().[1](4).[2](3).[3]({ name: -1 })
Drag options to blanks, or click blank then click option'
Askip
Blimit
Csort
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of methods.
Using count instead of sort for sorting.