title: Why am I getting this deprecated warning?! MongoDB
body: <p>I'm working with MongoDB in NodeJS,  </p>
  
  <pre><code>    const { MongoClient, ObjectId } = require("mongodb");
  
  const MONGO_URI = `mongodb://xxx:xxx@xxx/?authSource=xxx`; // prettier-ignore
  
  class MongoLib {
  
    constructor() {
      this.client = new MongoClient(MONGO_URI, {
        useNewUrlParser: true,
      });
      this.dbName = DB_NAME;
    }
  
    connect() {
      return new Promise((resolve, reject) =&gt; {
        this.client.connect(error =&gt; {
          if (error) {
            reject(error);
          }
          resolve(this.client.db(this.dbName));
        });
      });
    }
    async getUser(collection, username) {
      return this.connect().then(db =&gt; {
        return db
          .collection(collection)
          .find({ username })
          .toArray();
      });
    }
  }
  
  let c = new MongoLib();
  
  c.getUser("users", "pepito").then(result =&gt; console.log(result));
  c.getUser("users", "pepito").then(result =&gt; console.log(result));
  </code></pre>
  
  <p>and when the last c.getUser statement is executed (that's to say, when I make a SECOND connectio) Mongodb outputs this warning:</p>
  
  <pre><code>the options [servers] is not supported
  the options [caseTranslate] is not supported
  the options [username] is not supported
  the server/replset/mongos/db options are deprecated, all their options are supported at the top level of the options object [poolSize,ssl,sslValidate,sslCA,sslCert,sslKey,sslPass,sslCRL,autoReconnect,noDelay,keepAlive,keepAliveInitialDelay,connectTimeoutMS,family,socketTimeoutMS,reconnectTries,reconnectInterval,ha,haInterval,replicaSet,secondaryAcceptableLatencyMS,acceptableLatencyMS,connectWithNoPrimary,authSource,w,wtimeout,j,forceServerObjectId,serializeFunctions,ignoreUndefined,raw,bufferMaxEntries,readPreference,pkFactory,promiseLibrary,readConcern,maxStalenessSeconds,loggerLevel,logger,promoteValues,promoteBuffers,promoteLongs,domainsEnabled,checkServerIdentity,validateOptions,appname,auth,user,password,authMechanism,compression,fsync,readPreferenceTags,numberOfRetries,auto_reconnect,minSize,monitorCommands,retryWrites,useNewUrlParser]
  </code></pre>
  
  <p>But I'm not using any deprecated options. Any ideas?</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>After a little discussion with <em>molank</em> in the comments, it looks like open several connections from the same server is not a good practice, so maybe that's what the warning is trying to say (badly I think). So if you have the same problem, save the connection instead of the mongo client.</p>