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

You learned how to change the package.json dependencies back in the Expand Your Project with External Packages from npm challenge.

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:

What errors do you see when you click Run?

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

I do not see a database name in the connection string.

myproject is its name

Where you have written myproject, that is supposed to be your username. The part after the : should be your password (though you may have removed it for privacy).

If you read through the article that @lasjorg suggested, it will show you where everything goes.



does this screenshots are usefull

So your username is myproject. Can you click on the Browse Collection button under Database Deployments and show us what you see?


there it is

Looks like your DB name is test. Now that you know that, you should be able to use the article to create the correct connection string.