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

337
Views
Changing Mongoose schema type not working

I have a mongoose schema with a property which was a string array.

docs: [String]

I changed the type to an object array as follows

docs: [{ url: String, type: String }]

But when I create a new item, the docs field is still validated with the type string and the following error is thrown.

enter image description here

I even tried dropping the collection and it still not works.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The brackets should be around the type, and not the entire object. As documented here, instead of your Schema being:

docs: [{ url: String, type: String }]

It should be

docs: { url: String, type: [String] }
about 4 years ago · Juan Pablo Isaza 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!