Loading

Quipoin Menu

Learn • Practice • Grow

mongodb / Mongoose CRUD and Validation
mcq
Direction: Choose the correct option

Q1.

How do you create and save a new document using a Mongoose model?
A. `Model.insert(data)`
B. Both A and C
C. `new Model(data).save()`
D. `Model.create(data)`
Direction: Choose the correct option

Q2.

Which method finds documents in Mongoose?
A. `Model.where()`
B. `All of the above`
C. `Model.select()`
D. `Model.find()`
Direction: Choose the correct option

Q3.

How do you update a document in Mongoose?
A. `Model.findByIdAndUpdate()`
B. `Model.update()`
C. `All of the above`
D. `Model.updateOne()`
Direction: Choose the correct option

Q4.

What is validation in Mongoose?
A. Indexing data
B. Checking if data meets defined criteria before saving
C. Encrypting data
D. Compressing data
Direction: Choose the correct option

Q5.

How do you define a required field in a Mongoose schema?
A. { name: String, required: true }
B. { name: { type: String, isRequired: true } }
C. { name: { type: String, required: true } }
D. { name: { type: String, mandatory: true } }