MongoClient

The client implements the collecton https://docs.mongodb.com/manual/reference/method/js-collection api.

Initialization

MongoClient expects conection url as the first argument.

  var mongoClient = new  MongoClient('mongodb://UserId:Password@ServerUrl:ServerPort/DatabaseName');
  
  mongoClient.SomeCollection.find();

Find

The api is consistent with https://docs.mongodb.com/manual/reference/method/js-collection. For example, you can write the following to retrieve the desired data.

 // to find all items
  mongoClient.bios.find();
  
  // to find using filter
  db.bios.find({ _id: 5 });
  
  // to find with projection
   db.bios.find({ }, { name: 1, contribs: 1, _id: 0 });