-
Type: Epic
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Native
-
None
-
Not Needed
-
Done
-
Get rid of MongoClient.connect
Although we now conform to SDAM spec, we still diverge from other drivers in that we require an async call to MongoClient.prototype.connect before allowing operations on the client. This connect call involves many asynchronous actions like SRV resolution, instantiating connection pools, and initial server selection.
Current flow:
const client = new MongoClient('mongodb://localhost:27017'); // This command will error b/c the client is not connected. await client.db('foo').collection('bar').insertOne({ a: 1 }); // This is the proper workflow client.connect().then(async function() { await client.db('foo').collection('bar').insertOne({ a: 1 }); });
We'd like to eventually eliminate the need for this connect call so that all of the initial setup occurs as part of initial serverSelection.