Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

320
Views
if (schema == null || cd default!('pluralization' in schema.options)) // I'm using mongoose. What does this error mean?

I'm trying to create a simple CRUD app. Wrote a simple create logic to save data in mongoDB atlas using mongoose. enter image description here

Here is my model.js code (The file in which I take care of the mongoose schema and model)-

const mongoose=require('mongoose');
const userSchema=new mongoose.Schema({
    name:{
        type:String,
        required:true
    },
    email:{
        type:String,
        unique:true,
        required:true
    },
    gender:String,
    status:String
})

// var User=mongoose.model('User','userSchema');


module.exports=mongoose.model({collection:'Users'},'userSchema');

Here is my router.js code

route.post("/api/users",function(req,res){
    if(!req.body){
        res.status(400).send({message:"Content cannot be empty"});
        return;
    }
    //new user
    const userInstance=new User_({
        name:req.body.name,
        email:req.body.email,
        gender:req.body.gender,
        status:req.body.status
    })

    User_.save(userInstance).then(function(data){
        res.send(data);
    }).catch(err=>{
        res.status(500).send({message:err.message||"Some error occurred"})
    });

})

Please tell me what's wrong. I'm a beginner.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!