Skip to main content
Node.js Code Completion Hard +35 XP

Mongoose Schema

Complete the Mongoose model export.

Node.jsFill in the blank
const schema = new Schema({ name: String });
module.exports = ___("User", schema);

Type the missing code

Show answer and explanation

Answer: mongoose.model

mongoose.model() compiles a schema into a Model class used to interact with a MongoDB collection.

Hint: What mongoose function creates a Model?

What this challenge tests

Code Completion in Node.js: mongoose, mongodb.

Related challenges