Display MongoDB Collection Data in HTML
NickName:Eugene Koen Ask DateTime:2020-01-15T18:00:20

Display MongoDB Collection Data in HTML

So I'm new to MongoDB.

I am developing a website that I would like to GET data from a MongoDB collection based on a {Name: String} within that Collection and display it in an HTML Table.

This is what i have:

  • An Index.js file (server side js)
  • I have a MongoDB Collection called CustomersDB that has some data (documents) in it (i wrote code that saves it in this Customers collection and it works)

What i need:

What kind of code do I write in my index.js file for app.get('/customers') that would allow me to GET the data from the collection and display it in a table in my customers.ejs file.

The languages and others that I am using for this is: Node.js, Express , EJS, Body Parser, Cors and MongoDB

Copyright Notice:Content Author:「Eugene Koen」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/59748996/display-mongodb-collection-data-in-html

More about “Display MongoDB Collection Data in HTML” related questions

Display MongoDB Collection Data in HTML

So I'm new to MongoDB. I am developing a website that I would like to GET data from a MongoDB collection based on a {Name: String} within that Collection and display it in an HTML Table. This is...

Show Detail

MongoDB get data to display in HTML

I'm trying to display mongodb data in my html page. I've already managed to insert data in db but for some reason my "get" function does not work. I'm using node.js with express framework and Angu...

Show Detail

How to display mongoDB collection in html?

I am a beginner with mongoose and would like to display a mongoDB document(s) from "exColl" collection in a file called "example.ejs" in a basic html list however I have hit various problems. There...

Show Detail

NodeJS, MongoDB : Pass fetched data and display it on HTML

I have written below code to get data from mongodb : app.get('/StudentQuestionsPage',function(req,res){ var questions=""; MongoClient.connect(url, function (err, db) { if (err) { c...

Show Detail

Display data from mongodb to html page in realtime

I'm working on a python project, and I want to fetch and display data from mongodb in real-time, for example, display the new data in an html table page as soon as it's pushed to the DB, and the ot...

Show Detail

How can we display html field based on the data in collection?

I'm new to meteor, I want to retrieve the jenkins job and store that job detail with parameters inside mongoDB collection and then display different fields like text box, check button for that data...

Show Detail

get collection data in nodejs and mongodb

Tell me please, how can I create REST API using backbone application on the client and nodejs + mongodb in the server side. I am new in nodejs and can't understand all of the elementary things. J...

Show Detail

Fetch data from mongoDb and display it in html without using ejs

Basically I'm new to nodeJS, I wanted to display the mongoDb data in html table without using ejs as I have created other pages using html. I have found similar questions but they have given soluti...

Show Detail

How to display all entries in collection as html (node.js)

I want to display all entries in my collection (mongodb) as html. I've done this before with basic things, for example... router.get('/', function (req, res) { res.render('home', { title: 'E...

Show Detail

Display Mongodb collection in jade template

I'm new in node.js and mongodb. I set a mongodb collection called "article". I would like to display all the article of this collections in a jade template. I used this code : server.js: article...

Show Detail