MongoDB and Mongoose - Create Many Records with model.create()

Tell us what’s happening:
Describe your issue in detail here.
I’m getting this warning in the console, so far using replit has worked up to this challege. this seems like a possible error in the testing code, because it doesn’t refer to my script, and when I paste the solution in place of my own code, it gives the same error.

(node:1269) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Here is my code commented out with the solution code active. I get the same error for both, and as far as I can tell, my code is identical to the solution:

const createManyPeople = (arrayOfPeople, done) => {
 //  var peopleObj = [{name: 'Nancy', age: '55', favoriteFoods: ['ice cream', 'oreos']},
 //                  {name: 'Grace', age: '22', favoriteFoods: ['beer', 'hamburgers']},
 //                   {name: 'Peeta', age: '16', favoriteFoods: ['slugs', 'bread']}
 //                   ]
 // Person.create(function(err,data){
 //    if (err) return console.err(err)
 //    done(null, peopleObj)
 //  })
  /** 4) Create many People with `Model.create()` */
var arrayOfPeople = [
  {name: "Frankie", age: 74, favoriteFoods: ["Del Taco"]},
  {name: "Sol", age: 76, favoriteFoods: ["roast chicken"]},
  {name: "Robert", age: 78, favoriteFoods: ["wine"]}

var createManyPeople = function(arrayOfPeople, done) {
  Person.create(arrayOfPeople, function (err, people) {
    if (err) return console.log(err);
    done(null, people);

Your project link(s)

solution: boilerplate-mongomongoose - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: MongoDB and Mongoose - Create Many Records with model.create()

Link to the challenge:

This is the 2nd time in a row I solved my own problem. The depreciation warnings had nothing to do with it.

If you look closely I have a bunch of syntax errors and just overlooked some things that my eyes just didn’t see.

I’m having trouble figuring out the syntax for this challenge with the DB calls via mongoose taking place embedded in these callbacks.

It seems way more complicated than the mongoose tutorials. If anyone can help me understand how to follow the logic of what gets passed in to what.

Is this node.js syntax or some ES6 stuff?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.