Loading

Quipoin Menu

Learn • Practice • Grow

mongodb / Mongoose Schemas and Models
mcq
Direction: Choose the correct option

Q1.

What is a Schema in Mongoose?
A. A collection in MongoDB
B. A blueprint that defines the structure of documents
C. An instance of a database connection
D. A query
Direction: Choose the correct option

Q2.

How do you create a model from a schema in Mongoose?
A. mongoose.createModel('ModelName', schema)
B. schema.createModel('ModelName')
C. mongoose.model('ModelName', schema)
D. new mongoose.Model('ModelName', schema)
Direction: Choose the correct option

Q3.

What does a Mongoose Model represent?
A. A database connection
B. A collection in the database
C. A schema instance
D. A single document
Direction: Choose the correct option

Q4.

In a Mongoose schema definition, `name: String` means?
A. The `name` field is optional and can be any type
B. The `name` field has a default value of String
C. The `name` field must be a string
D. The `name` field is required and must be a string
Direction: Choose the correct option

Q5.

What is the purpose of the `timestamps: true` option in a schema?
A. Logs all operations
B. Automatically adds `createdAt` and `updatedAt` fields
C. Records the time of each query
D. Enables time-based indexing