nitesh sharma
nitesh sharma

Reputation: 601

can i access mongoDB console in nodeJs-mongoDb driver

Nodejs mongoDb driver code to access and create database

var mongo = require("mongodb");
var db = new mongo.Db("myapp", new mongo.Server("localhost", 27017));
var people = db.collection("people");

and to query

people.find()

Is there any way i can access mongoDb console in nodeJs mongoDb driver so i can test my queries there

Upvotes: 0

Views: 327

Answers (2)

christkv
christkv

Reputation: 4440

Any command you run in the console can be run through the driver using the .command function on the Db object. However I suggest you use the console of for management as it's a bit easier than duplicating the effort using the driver.

Upvotes: 1

mjhm
mjhm

Reputation: 16705

You're probably looking for mongo-sync or Mongolian DeadBeef which are advertised as nodejs drivers which more closely pattern the mongo command line interface. I would use them with caution though, since they are not core mongo supported drivers.

Upvotes: 0

Related Questions