Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.
This repository was archived by the owner on Apr 24, 2026. It is now read-only.

(node:12708) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. #2

Description

@vamsichowdary199

var express = require('express');
var router = express.Router();
var MongoClient = require('mongodb').MongoClient;
//var url = "mongodb://localhost:27017/EmployeeDB";

/* GET home page. */
router.get('/', function(req, res, next) {
var setAr =[]

MongoClient.connect(url, function(err, db) {
  
if (err) throw err;
var dbo = db.db("EmployeeDB");
//Exclude the _id field from the result:
dbo.collection("events").find({}).toArray(function(err, result) {
  if (err) throw err;
  //console.log(result);
  setAr = result[0].eventList
  console.log('your json data');

  res.render('home', { data : setAr });
  db.close();
});

});

module.exports = router;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions