Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHamayon Hussain
9,392 PointsThis course is outdated
This course needs to be updated because after using Animal.remove(), I got the following message after testing (node:10154) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead. db connection closed
A lot of beginner users will not be able to know whats going on and how to fix it.
johnywick
3,231 PointsI agree!
1 Answer
Tobiasz Gala
Full Stack JavaScript Techdegree Student 23,529 PointsIn most cases this is how your connect method should look like
mongoose.connect('mongodb://localhost:27017/collection_name', {
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false
});
Mike Hardy
Full Stack JavaScript Techdegree Graduate 16,511 PointsMike Hardy
Full Stack JavaScript Techdegree Graduate 16,511 PointsI used the 'deleteMany' and it worked.
I'm also getting this warning: (node:16460) 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.