You have typo in your #{restaurant.tables.length} it should be tabels
Length of array in jade undefined [closed]
-
12-10-2022 - |
Pregunta
I have code i want to show count of tables in restaurant My code is:
#{restaurant.tables.length}
But it not works for me and error me "Cannot read property 'length' of undefined".how can i solve this?
tables is array i fetch from mongodb collection.
i use mongoosejs "findOne" method, and my restaurant schema is :
var restuarantSchema = new Schema({
name : String,
details : String,
owner : String,
categories : {
name : String
},
users : [],
tabels: [{
title: String
}]
});
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow