We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When i call this router i got below data
app.get('/contacts/list', function(req, res){ db.collection('contacts').find().toArray((err, result) => { if (err) return console.log(err) //console.log(JSON.stringify(result) ); res.render('ListContact.html', {page_title:"All Contacts", contact: result}) db.close(); // console.log(result); }) });
Collection DATA
{ "_id" : ObjectId("57ea35b6d085c304201490a7"), "name" : "k", "mobile" : "k", "email" : "k@gmail.com", "company" : "k", "designation" : "k", "information" : [ { "owner" : "k", "website" : "k", "phone" : "k", "otherPhone" : "k", "skype" : "k", "LinkedIn" : null, "facebook" : "k", "Twitter" : "k", "google" : "k", "currency" : "k" } ], "BillingAddress" : [ { "addressline1" : "k", "addressline2" : "k", "city" : "k", "zipcode" : "k", "state" : "k", "country" : "k" } ], "Details" : [ { "description" : "k", "tags" : "k" } ] }
i want to display this value in html
<table class="table"> <thead> <tr> <th width="50px">No</th> <th>Name</th> <th>Designation</th> <th>Company</th> <th>Email</th> <th>Mobile</th> <th>Owner</th> <th>Tags</th> </tr> </thead> </thead> <tbody> <% if(contact.length){ for(var i = 0;i < contact.length;i++) { %> <tr> <td><%=(i+1)%></td> <td><%=contact[i].name%></td> <td><%=contact[i].designation%></td> <td><%=contact[i].company%></td> <td><%=contact[i].email%></td> <td><%=contact[i].mobile%></td> <td><%=contact[i].owner%></td> <td><%=contact[i].tags%></td> </tr> <% } }else{ %> <tr> <td colspan="3">No Contact in list</td> </tr> <% } %> </tbody> </table>
when run not display owner value
The text was updated successfully, but these errors were encountered:
How can i print that?
Best Regards, Gajendrasinh Zala
On Fri, Sep 30, 2016 at 3:15 AM, Varun Jayaraman notifications@github.com wrote:
Your owner value lives on an object within the information array, it doesn't live directly on contact — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub #4567 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AJ8rlFY-OhqZHZM_Km-KufPhOLFRsOraks5qvDGIgaJpZM4KHj1g .
Your owner value lives on an object within the information array, it doesn't live directly on contact
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub #4567 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AJ8rlFY-OhqZHZM_Km-KufPhOLFRsOraks5qvDGIgaJpZM4KHj1g .
Sorry, something went wrong.
Doesn't look like there's an owner property in your data. Perhaps you want to use contact: result.infortmation ?
contact: result.infortmation
Closing this since this just an issue of improperly accessing properties on the objects that live in the information array.
information
No branches or pull requests
When i call this router i got below data
app.get('/contacts/list', function(req, res){
db.collection('contacts').find().toArray((err, result) => {
if (err) return console.log(err)
//console.log(JSON.stringify(result) );
res.render('ListContact.html', {page_title:"All Contacts", contact: result})
db.close();
// console.log(result);
})
});
Collection DATA
{
"_id" : ObjectId("57ea35b6d085c304201490a7"),
"name" : "k",
"mobile" : "k",
"email" : "k@gmail.com",
"company" : "k",
"designation" : "k",
"information" : [
{
"owner" : "k",
"website" : "k",
"phone" : "k",
"otherPhone" : "k",
"skype" : "k",
"LinkedIn" : null,
"facebook" : "k",
"Twitter" : "k",
"google" : "k",
"currency" : "k"
}
],
"BillingAddress" : [
{
"addressline1" : "k",
"addressline2" : "k",
"city" : "k",
"zipcode" : "k",
"state" : "k",
"country" : "k"
}
],
"Details" : [
{
"description" : "k",
"tags" : "k"
}
]
}
i want to display this value in html
when run not display owner value
The text was updated successfully, but these errors were encountered: