Select data from node object
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
add a comment |
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
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
add a comment |
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
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
node.js object pagination
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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}}
Yes and it works thank :)
– Juraj Jakubov
Nov 26 '18 at 6:18
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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}}
Yes and it works thank :)
– Juraj Jakubov
Nov 26 '18 at 6:18
add a comment |
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}}
Yes and it works thank :)
– Juraj Jakubov
Nov 26 '18 at 6:18
add a comment |
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}}
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}}
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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