question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use mongodb driver directly?

See original GitHub issue

Hi @wzrdtales sorry if I’m asking something that has already been posted - but I didn’t find anything in the documentation or in the existing issues.

I wanted to ask if it is possible to use the mongodb driver directly? Like this for example:

exports.up = function (db) {
  return db.driver.collectionName.find({id: 'ID'}).then((collection) => {
    collection.property = 'newValue';
    return collection.save();
  });
}

The idea: I want to only update one property in one entry in the DB.

The reason: We have “base data” defined in our app that get’s initialized (and updated) with every release. This base data needs maintenance and it would be awesome if maintenance could be done with node-db-migrate.

Thanks for answering!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
BorntraegerMarccommented, Jan 10, 2018

Use it like this:

return db._run('getDbInstance')
        .then(dbDriver => {})
0reactions
ks-s-acommented, May 16, 2018

You could faced to migration terminating problem. Just close the dbDriver to avoid it.

return db._run('getDbInstance').then((dbDriver) => {
    return dbDriver.collection('collection_name')
      .findAll({
        prop: 'value'
      })
      .then(() => {
        return dbDriver.close();
      });
  });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Start Developing with MongoDB — MongoDB Drivers
Docs Home → MongoDB Drivers. Start Developing with MongoDB. Connect your application to your database with one of our official libraries.
Read more >
Add a MongoDB Driver — Start with Guides
Add the MongoDB .NET/C# driver using NuGet . Use MongoDB.Driver for all new projects. .
Read more >
MongoDB Node Driver — Node.js
Welcome to the documentation site for the official MongoDB Node.js driver. You can add the driver to your application to work with MongoDB...
Read more >
Connect via Your Application — MongoDB Atlas
The Connect dialog for a database deployment provides the details to connect to a database deployment with an application using a MongoDB driver....
Read more >
Using MongoDB Node.js Driver to connect to an instance from ...
Hello I've read some key features about MongoDB stitch. I believe it allows us querying the MongoDB from the client's browser using HTTP....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found