Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1716

docs tutorial shows connecting with MongoClient() incorrectly

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.8
    • Affects Version/s: Not Applicable
    • Component/s: Docs
    • None

      The CRUD tutorial page http://mongodb.github.io/node-mongodb-native/3.1/quick-start/quick-start/  (there are other pages too)

      Shows connecting as: 

      // Create a new MongoClient
      const client = new MongoClient(url);
      
      // Use connect method to connect to the Server
      client.connect(url, function(err, client) {
      ...
      }
      

      When this should have been just:

      MongoClient.connect(url, function(err, client) {
      ...
      }
      

      Or :

      MongoClient.connect(url, { useNewUrlParser: true }, function(err, client) {
      ... 
      } 
      

      This seems to be getting from master

      https://github.com/mongodb/node-mongodb-native/blob/master/docs/reference/layouts/shortcodes/myproject-connect.html

      However, the branch v3.0 and v3.1 seems to do it correctly

      https://github.com/mongodb/node-mongodb-native/blob/3.1/docs/reference/layouts/shortcodes/myproject-connect.html

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            wan.bachtiar@mongodb.com Wan Bachtiar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: