iterate through mongoose.models












-1














I am trying to get all mongoose model names and iterate through them at view (test.jade)



route



router.get('/dashboard', ensureAuthenticated, function (req, res) {
var models = mongoose.models;
console.log(models);
res.render('test',{data:models});
})


i got this log at node console:



{ User: 
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'User',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: ,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'users',
conn: [Object],
queue: ,
buffer: false } },
Comment:
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'Comment',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'comments',
conn: [Object],
queue: ,
buffer: false } },
Article:
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'Article',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'articles',
conn: [Object],
queue: ,
buffer: false } } }


view



for(var prop in data)
p #{prop}: #{data[prop]}


the problem is that I couldn't get any result after iteration operation at view










share|improve this question
























  • Does the rest of the view from test.jade get rendered correctly? If you add console.log(models) right after router.get(...){, do you see anything get printed in the node console?
    – pbkhrv
    Dec 10 '14 at 1:05










  • @pbkhrv test.jade is getting rendered correctly i have tested it. and i also loged the models inside router.get i got result which i will share it at my next edit.
    – semirturgay
    Dec 10 '14 at 1:09










  • I am expecting to see something like the node.js log ... currently i don't see any output at my view
    – semirturgay
    Dec 14 '14 at 15:09
















-1














I am trying to get all mongoose model names and iterate through them at view (test.jade)



route



router.get('/dashboard', ensureAuthenticated, function (req, res) {
var models = mongoose.models;
console.log(models);
res.render('test',{data:models});
})


i got this log at node console:



{ User: 
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'User',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: ,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'users',
conn: [Object],
queue: ,
buffer: false } },
Comment:
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'Comment',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'comments',
conn: [Object],
queue: ,
buffer: false } },
Article:
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'Article',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'articles',
conn: [Object],
queue: ,
buffer: false } } }


view



for(var prop in data)
p #{prop}: #{data[prop]}


the problem is that I couldn't get any result after iteration operation at view










share|improve this question
























  • Does the rest of the view from test.jade get rendered correctly? If you add console.log(models) right after router.get(...){, do you see anything get printed in the node console?
    – pbkhrv
    Dec 10 '14 at 1:05










  • @pbkhrv test.jade is getting rendered correctly i have tested it. and i also loged the models inside router.get i got result which i will share it at my next edit.
    – semirturgay
    Dec 10 '14 at 1:09










  • I am expecting to see something like the node.js log ... currently i don't see any output at my view
    – semirturgay
    Dec 14 '14 at 15:09














-1












-1








-1


0





I am trying to get all mongoose model names and iterate through them at view (test.jade)



route



router.get('/dashboard', ensureAuthenticated, function (req, res) {
var models = mongoose.models;
console.log(models);
res.render('test',{data:models});
})


i got this log at node console:



{ User: 
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'User',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: ,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'users',
conn: [Object],
queue: ,
buffer: false } },
Comment:
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'Comment',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'comments',
conn: [Object],
queue: ,
buffer: false } },
Article:
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'Article',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'articles',
conn: [Object],
queue: ,
buffer: false } } }


view



for(var prop in data)
p #{prop}: #{data[prop]}


the problem is that I couldn't get any result after iteration operation at view










share|improve this question















I am trying to get all mongoose model names and iterate through them at view (test.jade)



route



router.get('/dashboard', ensureAuthenticated, function (req, res) {
var models = mongoose.models;
console.log(models);
res.render('test',{data:models});
})


i got this log at node console:



{ User: 
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'User',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: ,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'users',
conn: [Object],
queue: ,
buffer: false } },
Comment:
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'Comment',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'comments',
conn: [Object],
queue: ,
buffer: false } },
Article:
{ [Function: model]
base:
{ connections: [Object],
plugins: ,
models: [Circular],
modelSchemas: [Object],
options: [Object] },
modelName: 'Article',
model: [Function: model],
db:
{ base: [Object],
collections: [Object],
models: [Circular],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: '',
pass: '',
name: 'simpleblog',
options: [Object],
otherDbs: ,
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: {},
db: [Object] },
discriminators: undefined,
schema:
{ paths: [Object],
subpaths: {},
virtuals: [Object],
nested: {},
inherits: {},
callQueue: ,
_indexes: ,
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
options: [Object],
_events: {} },
options: undefined,
collection:
{ collection: [Object],
opts: [Object],
name: 'articles',
conn: [Object],
queue: ,
buffer: false } } }


view



for(var prop in data)
p #{prop}: #{data[prop]}


the problem is that I couldn't get any result after iteration operation at view







node.js express mongoose






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 5:02









Cœur

17.4k9103145




17.4k9103145










asked Dec 10 '14 at 0:52









semirturgay

2,84122243




2,84122243












  • Does the rest of the view from test.jade get rendered correctly? If you add console.log(models) right after router.get(...){, do you see anything get printed in the node console?
    – pbkhrv
    Dec 10 '14 at 1:05










  • @pbkhrv test.jade is getting rendered correctly i have tested it. and i also loged the models inside router.get i got result which i will share it at my next edit.
    – semirturgay
    Dec 10 '14 at 1:09










  • I am expecting to see something like the node.js log ... currently i don't see any output at my view
    – semirturgay
    Dec 14 '14 at 15:09


















  • Does the rest of the view from test.jade get rendered correctly? If you add console.log(models) right after router.get(...){, do you see anything get printed in the node console?
    – pbkhrv
    Dec 10 '14 at 1:05










  • @pbkhrv test.jade is getting rendered correctly i have tested it. and i also loged the models inside router.get i got result which i will share it at my next edit.
    – semirturgay
    Dec 10 '14 at 1:09










  • I am expecting to see something like the node.js log ... currently i don't see any output at my view
    – semirturgay
    Dec 14 '14 at 15:09
















Does the rest of the view from test.jade get rendered correctly? If you add console.log(models) right after router.get(...){, do you see anything get printed in the node console?
– pbkhrv
Dec 10 '14 at 1:05




Does the rest of the view from test.jade get rendered correctly? If you add console.log(models) right after router.get(...){, do you see anything get printed in the node console?
– pbkhrv
Dec 10 '14 at 1:05












@pbkhrv test.jade is getting rendered correctly i have tested it. and i also loged the models inside router.get i got result which i will share it at my next edit.
– semirturgay
Dec 10 '14 at 1:09




@pbkhrv test.jade is getting rendered correctly i have tested it. and i also loged the models inside router.get i got result which i will share it at my next edit.
– semirturgay
Dec 10 '14 at 1:09












I am expecting to see something like the node.js log ... currently i don't see any output at my view
– semirturgay
Dec 14 '14 at 15:09




I am expecting to see something like the node.js log ... currently i don't see any output at my view
– semirturgay
Dec 14 '14 at 15:09












2 Answers
2






active

oldest

votes


















2





+50









In your route, try this:



router.get('/dashboard', ensureAuthenticated, function (req, res) {
var models = Object.keys(mongoose.models);
var schemas = mongoose.modelSchemas;
res.render('test',{models: models, schemas: schemas});
})


Then in your layout file, try this (assuming you're using jade)



each model in models
p #{model} :
each path in schemas[model].paths
div #{JSON.stringify(path)}





share|improve this answer























  • thank you.. it works great... so what was wrong in my way
    – semirturgay
    Dec 15 '14 at 16:50










  • The main problem was the way you were handling the loop in your Jade file. You were using for(var prop in data), which is not valid for Jade, so it was ignoring that line. Since it was ignoring that line when it got to the next line prop was undefined, so you didn't get any output.
    – Brian Shamblen
    Dec 15 '14 at 17:14










  • yes i get exactly what i want with your edits.. thanks again :)
    – semirturgay
    Dec 15 '14 at 17:16



















0














It's hard to tell, but it looks like you are possibly logging the function that builds the models, and not an instance of the models data.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f27391653%2fiterate-through-mongoose-models%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2





    +50









    In your route, try this:



    router.get('/dashboard', ensureAuthenticated, function (req, res) {
    var models = Object.keys(mongoose.models);
    var schemas = mongoose.modelSchemas;
    res.render('test',{models: models, schemas: schemas});
    })


    Then in your layout file, try this (assuming you're using jade)



    each model in models
    p #{model} :
    each path in schemas[model].paths
    div #{JSON.stringify(path)}





    share|improve this answer























    • thank you.. it works great... so what was wrong in my way
      – semirturgay
      Dec 15 '14 at 16:50










    • The main problem was the way you were handling the loop in your Jade file. You were using for(var prop in data), which is not valid for Jade, so it was ignoring that line. Since it was ignoring that line when it got to the next line prop was undefined, so you didn't get any output.
      – Brian Shamblen
      Dec 15 '14 at 17:14










    • yes i get exactly what i want with your edits.. thanks again :)
      – semirturgay
      Dec 15 '14 at 17:16
















    2





    +50









    In your route, try this:



    router.get('/dashboard', ensureAuthenticated, function (req, res) {
    var models = Object.keys(mongoose.models);
    var schemas = mongoose.modelSchemas;
    res.render('test',{models: models, schemas: schemas});
    })


    Then in your layout file, try this (assuming you're using jade)



    each model in models
    p #{model} :
    each path in schemas[model].paths
    div #{JSON.stringify(path)}





    share|improve this answer























    • thank you.. it works great... so what was wrong in my way
      – semirturgay
      Dec 15 '14 at 16:50










    • The main problem was the way you were handling the loop in your Jade file. You were using for(var prop in data), which is not valid for Jade, so it was ignoring that line. Since it was ignoring that line when it got to the next line prop was undefined, so you didn't get any output.
      – Brian Shamblen
      Dec 15 '14 at 17:14










    • yes i get exactly what i want with your edits.. thanks again :)
      – semirturgay
      Dec 15 '14 at 17:16














    2





    +50







    2





    +50



    2




    +50




    In your route, try this:



    router.get('/dashboard', ensureAuthenticated, function (req, res) {
    var models = Object.keys(mongoose.models);
    var schemas = mongoose.modelSchemas;
    res.render('test',{models: models, schemas: schemas});
    })


    Then in your layout file, try this (assuming you're using jade)



    each model in models
    p #{model} :
    each path in schemas[model].paths
    div #{JSON.stringify(path)}





    share|improve this answer














    In your route, try this:



    router.get('/dashboard', ensureAuthenticated, function (req, res) {
    var models = Object.keys(mongoose.models);
    var schemas = mongoose.modelSchemas;
    res.render('test',{models: models, schemas: schemas});
    })


    Then in your layout file, try this (assuming you're using jade)



    each model in models
    p #{model} :
    each path in schemas[model].paths
    div #{JSON.stringify(path)}






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 15 '14 at 16:06

























    answered Dec 14 '14 at 23:19









    Brian Shamblen

    4,03511732




    4,03511732












    • thank you.. it works great... so what was wrong in my way
      – semirturgay
      Dec 15 '14 at 16:50










    • The main problem was the way you were handling the loop in your Jade file. You were using for(var prop in data), which is not valid for Jade, so it was ignoring that line. Since it was ignoring that line when it got to the next line prop was undefined, so you didn't get any output.
      – Brian Shamblen
      Dec 15 '14 at 17:14










    • yes i get exactly what i want with your edits.. thanks again :)
      – semirturgay
      Dec 15 '14 at 17:16


















    • thank you.. it works great... so what was wrong in my way
      – semirturgay
      Dec 15 '14 at 16:50










    • The main problem was the way you were handling the loop in your Jade file. You were using for(var prop in data), which is not valid for Jade, so it was ignoring that line. Since it was ignoring that line when it got to the next line prop was undefined, so you didn't get any output.
      – Brian Shamblen
      Dec 15 '14 at 17:14










    • yes i get exactly what i want with your edits.. thanks again :)
      – semirturgay
      Dec 15 '14 at 17:16
















    thank you.. it works great... so what was wrong in my way
    – semirturgay
    Dec 15 '14 at 16:50




    thank you.. it works great... so what was wrong in my way
    – semirturgay
    Dec 15 '14 at 16:50












    The main problem was the way you were handling the loop in your Jade file. You were using for(var prop in data), which is not valid for Jade, so it was ignoring that line. Since it was ignoring that line when it got to the next line prop was undefined, so you didn't get any output.
    – Brian Shamblen
    Dec 15 '14 at 17:14




    The main problem was the way you were handling the loop in your Jade file. You were using for(var prop in data), which is not valid for Jade, so it was ignoring that line. Since it was ignoring that line when it got to the next line prop was undefined, so you didn't get any output.
    – Brian Shamblen
    Dec 15 '14 at 17:14












    yes i get exactly what i want with your edits.. thanks again :)
    – semirturgay
    Dec 15 '14 at 17:16




    yes i get exactly what i want with your edits.. thanks again :)
    – semirturgay
    Dec 15 '14 at 17:16













    0














    It's hard to tell, but it looks like you are possibly logging the function that builds the models, and not an instance of the models data.






    share|improve this answer


























      0














      It's hard to tell, but it looks like you are possibly logging the function that builds the models, and not an instance of the models data.






      share|improve this answer
























        0












        0








        0






        It's hard to tell, but it looks like you are possibly logging the function that builds the models, and not an instance of the models data.






        share|improve this answer












        It's hard to tell, but it looks like you are possibly logging the function that builds the models, and not an instance of the models data.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 14 '14 at 22:38









        RadleyMith

        1,048816




        1,048816






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f27391653%2fiterate-through-mongoose-models%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Full-time equivalent

            Bicuculline

            さくらももこ