Loading

Quipoin Menu

Learn • Practice • Grow

express-js / MongoDB + Mongoose with Express
mcq
Direction: Choose the correct option

Q1.

What is Mongoose?
A. A database
B. An ODM library for MongoDB and Node.js
C. A middleware
D. A templating engine
Direction: Choose the correct option

Q2.

How do you define a schema in Mongoose?
A. mongoose.createSchema({ ... })
B. mongoose.defineSchema({ ... })
C. new Schema({ ... })
D. const schema = new mongoose.Schema({ ... });
Direction: Choose the correct option

Q3.

What does mongoose.model('User', userSchema) return?
A. A connection
B. A Model class to interact with the 'users' collection
C. A document
D. A schema
Direction: Choose the correct option

Q4.

How do you connect to a MongoDB database using Mongoose?
A. mongoose.connect('mongodb://localhost/mydb')
B. mongoose.createConnection('mongodb://localhost/mydb')
C. mongoose.connection('mongodb://localhost/mydb')
D. mongoose.open('mongodb://localhost/mydb')
Direction: Choose the correct option

Q5.

Which method is used to find all documents in a Mongoose model?
A. Model.getAll()
B. Model.find()
C. Model.select()
D. Model.fetch()