MongoDB and Mongoose - Delete Many Documents with model.remove()

Tell us what’s happening:
Describe your issue in detail here.

Your project link(s)

solution: boilerplate-mongomongoose - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: MongoDB and Mongoose - Delete Many Documents with model.remove()

Link to the challenge:

May anybody tell me where is my problem please? Still can’t resolve this challenge.
Here’s my replit : ’ boilerplate-mongomongoose - Replit

Look at the output of the tests

mongodb version ~3.6.0" dependency should be in package.json

mongoose version ~5.4.0" dependency should be in package.json

When I correct the versions it passes for me (with my own DB)

what code should i use to make like this my mongoose and mongodb. Like what npm

Done still doesn’t work. I will die soon. Here mister is my replit. Where am i wrong? ’ boilerplate-mongomongoose - Replit ’ i made a new replit account because my problem was over there with my errors. But now I still don’t know where am I wrong :sob: :sob:

npm start

fcc-mongo-mongoose-challenges@0.0.1 start
node server.js

the options [userNewUrlParser] is not supported
the options [useUnifiedTopology] is not supported
{
favoriteFoods: [ ‘pizza’, ‘chips’ ],
_id: 62d08f8f5c33de10fb38ae2d,
name: ‘Dave’,
age: 27
}
(node:4347) Warning: Accessing non-existent property ‘count’ of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:4347) Warning: Accessing non-existent property ‘findOne’ of module exports inside circular dependency
(node:4347) Warning: Accessing non-existent property ‘remove’ of module exports inside circular dependency
(node:4347) Warning: Accessing non-existent property ‘updateOne’ of module exports inside circular dependency
(node:4347) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
Your app is listening on port 3000

~/boilerplate-mongomongoose$ node --trace-warnings …
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module ‘/home/runner/boilerplate-mongomongoose/…’
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47 {
code: ‘MODULE_NOT_FOUND’,
requireStack:
}
~/boilerplate-mongomongoose$
and this when i put node --trace-warnings …

I see this response.

(Unauthorized) not authorized on admin to execute command { delete: "people", deletes: [[{q []} {limit 0}]], ordered: true, writeConcern: { w: "majority" }, $clusterTime: { clusterTime: {1657835759 1}, signature: { hash: {0 [40 108 5 114 34 43 113 103 153 112 100 149 78 161 143 172 216 227 79 178]}, keyId: 7072019353465520128.000000 } }, lsid: { id: {4 [93 130 96 165 194 177 70 245 162 79 162 131 16 79 224 151]} } }

What is your DB name in the connection string and do you have one?

mongodb+srv://name:password@someClusterName.whateverIsHere.mongodb.net/myFirstDatabase?retryWrites=true&w=majority

Yes. I put the name “myproject”

And when I put
const removeManyPeople = (done) => {
const nameToRemove = “Mary”;

Person.remove({ name: nameToRemove }, (err, data) => {
done(err, data);
})
};
they give me these error

npm start

fcc-mongo-mongoose-challenges@0.0.1 start
node server.js

the options [userNewUrlParser] is not supported
the options [useUnifiedTopology] is not supported
{
favoriteFoods: [ ‘pizza’, ‘chips’ ],
_id: 62d093b4141157156530a2fe,
name: ‘Dave’,
age: 27
}
(node:5477) Warning: Accessing non-existent property ‘count’ of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:5477) Warning: Accessing non-existent property ‘findOne’ of module exports inside circular dependency
(node:5477) Warning: Accessing non-existent property ‘remove’ of module exports inside circular dependency
(node:5477) Warning: Accessing non-existent property ‘updateOne’ of module exports inside circular dependency
(node:5477) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
Your app is listening on port 3000

Can we see your connection string, remove the password.

Not sure why this would be a problem now and not before (unless you changed something?). Make sure you have the correct connection string.

mongodb+srv://myproject:@cluster.ynhd6.mongodb.net/?retryWrites=true&w=majority

myproject is its name



does this screenshots are usefull


there it is

so my link should be ‘mongodb+srv://myproject:@test.ynhd6.mongodb.net/?retryWrites=true&w=majority’?

mongodb+srv://:@cluster.ynhd6.mongodb.net/?retryWrites=true&w=majority
that’s my link over there

You need to add the DB name yourself to the connection string. Read the article I posted. Look near the end.

Don’t get it. That’s my link mongodb+srv://myproject:@cluster.ynhd6.mongodb.net/?retryWrites=true&w=majority what should it be?

Please read the article and look at the example I posted.

mongodb+srv://name:password@someClusterName.whateverIsHere.mongodb.net/myFirstDatabase?retryWrites=true&w=majority

npm start

fcc-mongo-mongoose-challenges@0.0.1 start
node server.js

the options [userNewUrlParser] is not supported
the options [useUnifiedTopology] is not supported
{
favoriteFoods: [ ‘pizza’, ‘chips’ ],
_id: 62d0a073bc0432028f9ad679,
name: ‘Dave’,
age: 27
}
(node:655) Warning: Accessing non-existent property ‘count’ of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:655) Warning: Accessing non-existent property ‘findOne’ of module exports inside circular dependency
(node:655) Warning: Accessing non-existent property ‘remove’ of module exports inside circular dependency
(node:655) Warning: Accessing non-existent property ‘updateOne’ of module exports inside circular dependency
(node:655) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
Your app is listening on port 3000
/home/runner/boilerplate-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js:21
return callback(new Error(‘Invalid schema, expected mongodb or mongodb+srv’));
^

Error: Invalid schema, expected mongodb or mongodb+srv
at module.exports (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js:21:21)
at deprecated (node:internal/util:110:12)
at connect (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/mongo_client_ops.js:188:3)
at connectOp (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/mongo_client_ops.js:292:3)
at executeOperation (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/utils.js:420:24)
at MongoClient.connect (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js:168:10)
at /home/runner/boilerplate-mongomongoose/node_modules/mongoose/lib/connection.js:527:12
at new Promise ()
at NativeConnection.Connection.openUri (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/lib/connection.js:524:19)
at Mongoose.connect (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/lib/index.js:271:15)
at Object. (/home/runner/boilerplate-mongomongoose/myApp.js:5:10)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
exit status 1