Select data from node object












0















I want to show email from object in node.



This is my route



// View users
router.get("/show", function (req, res, next) {

var query = {};
var options = {};

User.paginate(query, options).then(function (result) {
return res.render("../modules/users/views/userList", {
layout: 'cmsLayout',
users: result.docs,
page: parseInt(result.page),
pages: parseInt(result.pages)
});
});
});


and my handlebars



    <h1>{{users}}</h1> // WORK
{ created: 2018-11-25T20:33:19.531Z, _id: 5bfb070fa18eb649e0b5ea97, firstname: 'Jxxxx', lastname: 'xxxx', email: 'xxxxx', password: 'xxxxxx', ipadress: '::1', provider: 'local', status: '1', secretToken: 'xxxxxx', __v: 0 }

<h1>{{users.email}}</h1> // WONT WORK


I know its really stupid question but i cant figure out how to show only email or only firstname...










share|improve this question

























  • How did you get the timestamp? It seems confusing with all these colons

    – gkont
    Nov 25 '18 at 22:21













  • @gkont Well it need to be edited of course. But this is my way. created: { type: Date, default: Date.now, }

    – Juraj Jakubov
    Nov 26 '18 at 17:41
















0















I want to show email from object in node.



This is my route



// View users
router.get("/show", function (req, res, next) {

var query = {};
var options = {};

User.paginate(query, options).then(function (result) {
return res.render("../modules/users/views/userList", {
layout: 'cmsLayout',
users: result.docs,
page: parseInt(result.page),
pages: parseInt(result.pages)
});
});
});


and my handlebars



    <h1>{{users}}</h1> // WORK
{ created: 2018-11-25T20:33:19.531Z, _id: 5bfb070fa18eb649e0b5ea97, firstname: 'Jxxxx', lastname: 'xxxx', email: 'xxxxx', password: 'xxxxxx', ipadress: '::1', provider: 'local', status: '1', secretToken: 'xxxxxx', __v: 0 }

<h1>{{users.email}}</h1> // WONT WORK


I know its really stupid question but i cant figure out how to show only email or only firstname...










share|improve this question

























  • How did you get the timestamp? It seems confusing with all these colons

    – gkont
    Nov 25 '18 at 22:21













  • @gkont Well it need to be edited of course. But this is my way. created: { type: Date, default: Date.now, }

    – Juraj Jakubov
    Nov 26 '18 at 17:41














0












0








0


0






I want to show email from object in node.



This is my route



// View users
router.get("/show", function (req, res, next) {

var query = {};
var options = {};

User.paginate(query, options).then(function (result) {
return res.render("../modules/users/views/userList", {
layout: 'cmsLayout',
users: result.docs,
page: parseInt(result.page),
pages: parseInt(result.pages)
});
});
});


and my handlebars



    <h1>{{users}}</h1> // WORK
{ created: 2018-11-25T20:33:19.531Z, _id: 5bfb070fa18eb649e0b5ea97, firstname: 'Jxxxx', lastname: 'xxxx', email: 'xxxxx', password: 'xxxxxx', ipadress: '::1', provider: 'local', status: '1', secretToken: 'xxxxxx', __v: 0 }

<h1>{{users.email}}</h1> // WONT WORK


I know its really stupid question but i cant figure out how to show only email or only firstname...










share|improve this question
















I want to show email from object in node.



This is my route



// View users
router.get("/show", function (req, res, next) {

var query = {};
var options = {};

User.paginate(query, options).then(function (result) {
return res.render("../modules/users/views/userList", {
layout: 'cmsLayout',
users: result.docs,
page: parseInt(result.page),
pages: parseInt(result.pages)
});
});
});


and my handlebars



    <h1>{{users}}</h1> // WORK
{ created: 2018-11-25T20:33:19.531Z, _id: 5bfb070fa18eb649e0b5ea97, firstname: 'Jxxxx', lastname: 'xxxx', email: 'xxxxx', password: 'xxxxxx', ipadress: '::1', provider: 'local', status: '1', secretToken: 'xxxxxx', __v: 0 }

<h1>{{users.email}}</h1> // WONT WORK


I know its really stupid question but i cant figure out how to show only email or only firstname...







node.js object pagination






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 18:41







Juraj Jakubov

















asked Nov 25 '18 at 22:00









Juraj JakubovJuraj Jakubov

146213




146213













  • How did you get the timestamp? It seems confusing with all these colons

    – gkont
    Nov 25 '18 at 22:21













  • @gkont Well it need to be edited of course. But this is my way. created: { type: Date, default: Date.now, }

    – Juraj Jakubov
    Nov 26 '18 at 17:41



















  • How did you get the timestamp? It seems confusing with all these colons

    – gkont
    Nov 25 '18 at 22:21













  • @gkont Well it need to be edited of course. But this is my way. created: { type: Date, default: Date.now, }

    – Juraj Jakubov
    Nov 26 '18 at 17:41

















How did you get the timestamp? It seems confusing with all these colons

– gkont
Nov 25 '18 at 22:21







How did you get the timestamp? It seems confusing with all these colons

– gkont
Nov 25 '18 at 22:21















@gkont Well it need to be edited of course. But this is my way. created: { type: Date, default: Date.now, }

– Juraj Jakubov
Nov 26 '18 at 17:41





@gkont Well it need to be edited of course. But this is my way. created: { type: Date, default: Date.now, }

– Juraj Jakubov
Nov 26 '18 at 17:41












1 Answer
1






active

oldest

votes


















1














Looks like you're using mongoose with mongoose-paginate. According to the docs, the parameter passed to paginate's callback (ie. result) should be an array. This can be confirmed by checking the return value of typeof result.docs. You might want to do this in your handlebars template:



{{#each users}}
<h1>{{this.email}}</h1>
{{/each}}





share|improve this answer
























  • Yes and it works thank :)

    – Juraj Jakubov
    Nov 26 '18 at 6:18











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%2f53472438%2fselect-data-from-node-object%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Looks like you're using mongoose with mongoose-paginate. According to the docs, the parameter passed to paginate's callback (ie. result) should be an array. This can be confirmed by checking the return value of typeof result.docs. You might want to do this in your handlebars template:



{{#each users}}
<h1>{{this.email}}</h1>
{{/each}}





share|improve this answer
























  • Yes and it works thank :)

    – Juraj Jakubov
    Nov 26 '18 at 6:18
















1














Looks like you're using mongoose with mongoose-paginate. According to the docs, the parameter passed to paginate's callback (ie. result) should be an array. This can be confirmed by checking the return value of typeof result.docs. You might want to do this in your handlebars template:



{{#each users}}
<h1>{{this.email}}</h1>
{{/each}}





share|improve this answer
























  • Yes and it works thank :)

    – Juraj Jakubov
    Nov 26 '18 at 6:18














1












1








1







Looks like you're using mongoose with mongoose-paginate. According to the docs, the parameter passed to paginate's callback (ie. result) should be an array. This can be confirmed by checking the return value of typeof result.docs. You might want to do this in your handlebars template:



{{#each users}}
<h1>{{this.email}}</h1>
{{/each}}





share|improve this answer













Looks like you're using mongoose with mongoose-paginate. According to the docs, the parameter passed to paginate's callback (ie. result) should be an array. This can be confirmed by checking the return value of typeof result.docs. You might want to do this in your handlebars template:



{{#each users}}
<h1>{{this.email}}</h1>
{{/each}}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 '18 at 1:15









fardjadfardjad

14.6k53862




14.6k53862













  • Yes and it works thank :)

    – Juraj Jakubov
    Nov 26 '18 at 6:18



















  • Yes and it works thank :)

    – Juraj Jakubov
    Nov 26 '18 at 6:18

















Yes and it works thank :)

– Juraj Jakubov
Nov 26 '18 at 6:18





Yes and it works thank :)

– Juraj Jakubov
Nov 26 '18 at 6:18




















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53472438%2fselect-data-from-node-object%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

Costa Masnaga

Fotorealismo

Sidney Franklin