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

[Work In Progress]: Update to 3.0.2 MongoDB Driver#13

Closed
Lily418 wants to merge 3 commits intofloatdrop:masterfrom
Lily418:master
Closed

[Work In Progress]: Update to 3.0.2 MongoDB Driver#13
Lily418 wants to merge 3 commits intofloatdrop:masterfrom
Lily418:master

Conversation

@Lily418
Copy link

@Lily418 Lily418 commented Feb 10, 2018

Breaking Change

There was a breaking change in MongoDB 3.0.0

MongoClient.connect works as expected but it returns the MongoClient instance instead of a database object.
Changes in 3.0.0

What this PR Does

This PR adds database name as an additional parameter and adds this database to the req object.

Performance

I believe that using the db method this way is not a performace issue because these instances will be cached.

Child db instances are cached so performing db('db1') twice will return the same instance.
You can control these behaviors with the options noListener and returnNonCachedInstance.

Alternatives

It would be possible to rewrite this to make database name optional and return either a client object or a database object depending on if database name is provided. Not sure how common users will want to connect to multiple databases so for now avoided the extra code complexity.

Issues

I've encountered an issue with updating the tests, they timeout and I'm not sure what is still running that's stopping the process from ending.

const MongoClient = require('mongodb').MongoClient;
const connection = MongoClient.connect("badconnectionstring");

I'm not familiar with tap so not sure how to proceed with with.

@Lily418 Lily418 changed the title Update to 3.0.2 MongoDB Driver [Work In Progress]: Update to 3.0.2 MongoDB Driver Feb 10, 2018
@Lily418 Lily418 closed this Mar 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant