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

114
Views
No puedo mostrar la longitud de una matriz en ejs

Entonces estoy haciendo un siguiente sistema usando mangosta.

este es el esquema

 const usersSchema = new mongoose.Schema({ username: { type: String, required: true, unique: true, }, password: { type: String, required: true, }, email: { type: String, required: true, unique: true, }, followers:[{ type: mongoose.SchemaTypes.ObjectId, ref: 'User', default:null }], following:[{ type: mongoose.SchemaTypes.ObjectId, ref: 'User', default:null }]

Estoy tratando de mostrar la longitud de la longitud de los objetos en los seguidores y siguiendo las matrices usando ejs. Este es el codigo ejs

 <table border="1px"> <th> S. No </th> <th>Username</th> <th>Followers</th> <th>Following</th> <th>Edit</th> <% data.allUser.forEach((item)=> { %> <tr> <td> <%= k++ %> </td> <td> <%= item.username %> </td> <td> <% for (let l = 0; l < data.length; l++){ %> <%= item.followers[l] %> <%}%> </td> <td> <% for (let m = 0; m < data.length; m++){ %> <%= item.following[m] %> <%}%> </td> <td> <form action="/follow/ <%= item._id%>" method="POST" > <button id="<%= item._id %>">Follow</button> </form> </td> <% }) %>

La tabla se representa pero las columnas están vacías.

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!