3

I am using mongodb and mongoose for my database. How can I retrieve data from mongodb using nodejs and display the contents in an ejs page? I have searched a lot and I still couldn't find the solution.

This is my Schema

var mongoose = require("mongoose");

 var Schema = mongoose.Schema;

 var UserSchema = new Schema({

     username:String,
     _id:String,
     dateOfBirth:Date,
     telephoneNo:Number,
     address:String,
     email:String,
     fb_Id:String,
     jobTitle:String,
     password:String
 });

 module.exports=mongoose.model('User',UserSchema);
Sumeet Kumar Yadav
  • 10,459
  • 5
  • 39
  • 68
Kabilesh
  • 918
  • 5
  • 18
  • 42

0 Answers0