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

317
Views
Mongoose schema , how to define an Array of Array object

Is the following Mongoose schema correct ?

const TableSchema = new mongoose.Schema({
  meta: {... },
  columns: [{...}],
  lines: [[Schema.Types.Mixed]]
});

using the following table

  let table1 = {
    meta: { ... },
    columns: [ { ... }, { ... } ],
    lines: [[12, 'Joe'], [14, 'John'], [6, 'Walter'], [3, 'William'], [18, 'Bill'], [22, 'Albert']]
  };

when I get and display the table, the lines array is empty :

table:  { 
_id: 5903113e80587e09bf39be34,
  __v: 0,
  lines: [],
  columns: 
   [ { _id: 5903113e80587e09bf39be36, ... },
     { _id: 5903113e80587e09bf39be35, ... } ],
  meta: 
   { name: 'TA-PRIV-123', ... }
}

UPDATE 1

I also tried

   const Line = new mongoose.Schema([Schema.Types.Mixed]);
   const TableSchema = new mongoose.Schema({
     ...
     lines: [Line]
   });
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

solved

I forgot to add the lines in the previous POST request so the lines field was empty.. so Maxime feedback is right.. and my UPDATE 1 runs well

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!