1
votes

I'd like to use mongoose driver API in my web application but I'd like also have an embedded database for my app. I don't want install mongodb in the server. Is there any embedded database for node.js that allows to use mongoose driver and use MongoDB API?

I found NeDB but it doesn't seem to allow using mongoose.

Thanks

1

1 Answers

1
votes

You can use cloud databases, such as https://cloud.mongodb.com/

with this code

 const MongoClient = require('mongodb').MongoClient;
const uri = "mongodb+srv://<username>:<password>@<suburl>.mongodb.net/<dbname>?retryWrites=true&w=majority";
const client = new MongoClient(uri, { useNewUrlParser: true });
client.connect(err => {
  const collection = client.db("test").collection("devices");
  // perform actions on the collection object
  client.close();
});