Length of array in jade undefined

express, javascript, node.js, pug, template-engine

Solution

You have a typo in your `#{restaurant.tables.length}` it should be `tabels`

Problem

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 }] }); ```

Original source