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

555
Views
Mongoose Data Types how to define multiple type values ? ESLint error

I would like to define a filed 'lines' as an Array of values which can be of different types ( numbers or strings or boolean or dates )

when I try :

lines: [
{
  type: String,
  content: Mixed
}

]

I get an ESLint error error : Mixed is not defined

Should I write ?

 const Schema = mongoose.Schema;
 ...
 lines: [
   Schema.Types.Mixed
 ]
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

According to mongoose documentation you can use Mixed schema type as follows

var schema = new Schema({
ofMixed:    [Schema.Types.Mixed],
})

// example use

var Thing = mongoose.model('Thing', schema);

m.ofMixed = [1, [], 'three', { four: 5 }];
m.save(callback);
over 4 years ago · Santiago Trujillo Report
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!