Mongodb deleteOne()

Someone please help me . I am using Mongodb deleteOne() function .

here is the code=>

 var id=req.body._id;

 client.db('test').collection(project).deleteOne({_id:ObjectId(id)},(err,doc)=>{
                if(err){return err}
                else{res.send('success deleted id : '+id)}
              })

Why it is showing following error in console?

the options [servers] is not supported

the options [caseTranslate] is not supported

the options [dbName] is not supported

the options [credentials] is not supported

the options [servers] is not supported

the options [caseTranslate] is not supported

the options [dbName] is not supported

the options [credentials] 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,useUnifiedTopology,serverSelectionTimeoutMS,useRecoveryToken]

the options [source] is not supported

the options [mechanism] is not supported

the options [mechanismProperties] is not supported

From what I can see, the error is not necessarily in your use of the deleteOne method. It seems to be that you are using client.db(). I would rewrite it as:

**.db('test').collection(...)...

I do not know what the rest of your code is. ** depends on how you connected to the database.

Hope this helps.

I’m getting the same errors. Did you find out the reason?