mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.18k stars 22.47k forks source link

Error while running the populatedb.js script #23356

Closed anujaggarwal closed 1 year ago

anujaggarwal commented 1 year ago

MDN URL

https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/mongoose

What specific section or headline is this issue about?

Testing — create some items

What information was incorrect, unhelpful, or incomplete?

Section "Testing — create some items" talks about using populatedb.js script to create fictional objects in the database.

When the script is executed through command line, it might result in the below error for some users:

aal@As-MacBook-Pro express-locallibrary-tutorial % node populatedb "mongodb+srv://root:root@cluster0.j6igl.mongodb.net/local_library?retryWrites=true&w=majority"
This script populates some test books, authors, genres and bookinstances to your database. Specified database as argument - e.g.: populatedb mongodb+srv://cooluser:coolpassword@cluster0.lz91hw2.mongodb.net/?retryWrites=true&w=majority
Entering: createGenreAuthors
Entering: authorCreate
(node:1357) [MONGOOSE] DeprecationWarning: Mongoose: the `strictQuery` option will be switched back to `false` by default in Mongoose 7. Use `mongoose.set('strictQuery', false);` if you want to prepare for this change. Or use `mongoose.set('strictQuery', true);` to suppress this warning.
(Use `node --trace-deprecation ...` to show where the warning was created)
FINAL ERR: MongooseError: Operation `authors.insertOne()` buffering timed out after 10000ms

What did you expect to see?

The script should have executed with out any error.

Correct output after I fixed the script and re-ran it:

aal@As-MacBook-Pro express-locallibrary-tutorial % node populatedb "mongodb+srv://root:root@cluster0.j6igl.mongodb.net/local_library?retryWrites=true&w=majority"
This script populates some test books, authors, genres and bookinstances to your database. Specified database as argument - e.g.: populatedb mongodb+srv://cooluser:coolpassword@cluster0.lz91hw2.mongodb.net/?retryWrites=true&w=majority
Starting script to create objects in the database ...
Sleep for some time first
Hope you have slept, check the time first: 
Entering: createGenreAuthors
Entering: authorCreate
(node:1997) [MONGOOSE] DeprecationWarning: Mongoose: the `strictQuery` option will be switched back to `false` by default in Mongoose 7. Use `mongoose.set('strictQuery', false);` if you want to prepare for this change. Or use `mongoose.set('strictQuery', true);` to suppress this warning.
(Use `node --trace-deprecation ...` to show where the warning was created)
New Author: {
  first_name: 'Patrick',
  family_name: 'Rothfuss',
  date_of_birth: 1973-06-06T00:00:00.000Z,
  _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
  __v: 0
}
Entering: authorCreate
New Author: {
  first_name: 'Ben',
  family_name: 'Bova',
  date_of_birth: 1932-11-07T18:30:00.000Z,
  _id: new ObjectId("63b46f855ab0689e7cec3a2b"),
  __v: 0
}
Entering: authorCreate
New Author: {
  first_name: 'Isaac',
  family_name: 'Asimov',
  date_of_birth: 1920-01-02T00:00:00.000Z,
  date_of_death: 1992-04-06T00:00:00.000Z,
  _id: new ObjectId("63b46f855ab0689e7cec3a2d"),
  __v: 0
}
Entering: authorCreate
New Author: {
  first_name: 'Bob',
  family_name: 'Billings',
  _id: new ObjectId("63b46f855ab0689e7cec3a2f"),
  __v: 0
}
Entering: authorCreate
New Author: {
  first_name: 'Jim',
  family_name: 'Jones',
  date_of_birth: 1971-12-16T00:00:00.000Z,
  _id: new ObjectId("63b46f855ab0689e7cec3a31"),
  __v: 0
}
Entering: genreCreate
New Genre: {
  name: 'Fantasy',
  _id: new ObjectId("63b46f855ab0689e7cec3a33"),
  __v: 0
}
Entering: genreCreate
New Genre: {
  name: 'Science Fiction',
  _id: new ObjectId("63b46f855ab0689e7cec3a35"),
  __v: 0
}
Entering: genreCreate
New Genre: {
  name: 'French Poetry',
  _id: new ObjectId("63b46f855ab0689e7cec3a37"),
  __v: 0
}
Entering: createBooks
Entering: bookCreate
Entering: bookCreate
Entering: bookCreate
Entering: bookCreate
Entering: bookCreate
Entering: bookCreate
Entering: bookCreate
New Book: {
  title: 'The Name of the Wind (The Kingkiller Chronicle, #1)',
  author: {
    first_name: 'Patrick',
    family_name: 'Rothfuss',
    date_of_birth: 1973-06-06T00:00:00.000Z,
    _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
    __v: 0
  },
  summary: 'I have stolen princesses back from sleeping barrow kings. I burned down the town of Trebon. I have spent the night with Felurian and left with both my sanity and my life. I was expelled from the University at a younger age than most people are allowed in. I tread paths by moonlight that others fear to speak of during day. I have talked to Gods, loved women, and written songs that make the minstrels weep.',
  isbn: '9781473211896',
  genre: [
    {
      name: 'Fantasy',
      _id: new ObjectId("63b46f855ab0689e7cec3a33"),
      __v: 0
    }
  ],
  _id: new ObjectId("63b46f855ab0689e7cec3a39"),
  __v: 0
}
New Book: {
  title: 'The Slow Regard of Silent Things (Kingkiller Chronicle)',
  author: {
    first_name: 'Patrick',
    family_name: 'Rothfuss',
    date_of_birth: 1973-06-06T00:00:00.000Z,
    _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
    __v: 0
  },
  summary: 'Deep below the University, there is a dark place. Few people know of it: a broken web of ancient passageways and abandoned rooms. A young woman lives there, tucked among the sprawling tunnels of the Underthing, snug in the heart of this forgotten place.',
  isbn: '9780756411336',
  genre: [
    {
      name: 'Fantasy',
      _id: new ObjectId("63b46f855ab0689e7cec3a33"),
      __v: 0
    }
  ],
  _id: new ObjectId("63b46f855ab0689e7cec3a3b"),
  __v: 0
}
New Book: {
  title: "The Wise Man's Fear (The Kingkiller Chronicle, #2)",
  author: {
    first_name: 'Patrick',
    family_name: 'Rothfuss',
    date_of_birth: 1973-06-06T00:00:00.000Z,
    _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
    __v: 0
  },
  summary: 'Picking up the tale of Kvothe Kingkiller once again, we follow him into exile, into political intrigue, courtship, adventure, love and magic... and further along the path that has turned Kvothe, the mightiest magician of his age, a legend in his own time, into Kote, the unassuming pub landlord.',
  isbn: '9788401352836',
  genre: [
    {
      name: 'Fantasy',
      _id: new ObjectId("63b46f855ab0689e7cec3a33"),
      __v: 0
    }
  ],
  _id: new ObjectId("63b46f855ab0689e7cec3a3a"),
  __v: 0
}
New Book: {
  title: 'Test Book 1',
  author: {
    first_name: 'Jim',
    family_name: 'Jones',
    date_of_birth: 1971-12-16T00:00:00.000Z,
    _id: new ObjectId("63b46f855ab0689e7cec3a31"),
    __v: 0
  },
  summary: 'Summary of test book 1',
  isbn: 'ISBN111111',
  genre: [
    {
      name: 'Fantasy',
      _id: new ObjectId("63b46f855ab0689e7cec3a33"),
      __v: 0
    },
    {
      name: 'Science Fiction',
      _id: new ObjectId("63b46f855ab0689e7cec3a35"),
      __v: 0
    }
  ],
  _id: new ObjectId("63b46f855ab0689e7cec3a3e"),
  __v: 0
}
New Book: {
  title: 'Test Book 2',
  author: {
    first_name: 'Jim',
    family_name: 'Jones',
    date_of_birth: 1971-12-16T00:00:00.000Z,
    _id: new ObjectId("63b46f855ab0689e7cec3a31"),
    __v: 0
  },
  summary: 'Summary of test book 2',
  isbn: 'ISBN222222',
  genre: [],
  _id: new ObjectId("63b46f855ab0689e7cec3a3f"),
  __v: 0
}
New Book: {
  title: 'Apes and Angels',
  author: {
    first_name: 'Ben',
    family_name: 'Bova',
    date_of_birth: 1932-11-07T18:30:00.000Z,
    _id: new ObjectId("63b46f855ab0689e7cec3a2b"),
    __v: 0
  },
  summary: 'Humankind headed out to the stars not for conquest, nor exploration, nor even for curiosity. Humans went to the stars in a desperate crusade to save intelligent life wherever they found it. A wave of death is spreading through the Milky Way galaxy, an expanding sphere of lethal gamma ...',
  isbn: '9780765379528',
  genre: [
    {
      name: 'Science Fiction',
      _id: new ObjectId("63b46f855ab0689e7cec3a35"),
      __v: 0
    }
  ],
  _id: new ObjectId("63b46f855ab0689e7cec3a3c"),
  __v: 0
}
New Book: {
  title: 'Death Wave',
  author: {
    first_name: 'Ben',
    family_name: 'Bova',
    date_of_birth: 1932-11-07T18:30:00.000Z,
    _id: new ObjectId("63b46f855ab0689e7cec3a2b"),
    __v: 0
  },
  summary: "In Ben Bova's previous novel New Earth, Jordan Kell led the first human mission beyond the solar system. They discovered the ruins of an ancient alien civilization. But one alien AI survived, and it revealed to Jordan Kell that an explosion in the black hole at the heart of the Milky Way galaxy has created a wave of deadly radiation, expanding out from the core toward Earth. Unless the human race acts to save itself, all life on Earth will be wiped out...",
  isbn: '9780765379504',
  genre: [
    {
      name: 'Science Fiction',
      _id: new ObjectId("63b46f855ab0689e7cec3a35"),
      __v: 0
    }
  ],
  _id: new ObjectId("63b46f855ab0689e7cec3a3d"),
  __v: 0
}
Entering: createBookInstances
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
Entering: bookInstanceCreate
New BookInstance: {
  book: {
    title: 'The Slow Regard of Silent Things (Kingkiller Chronicle)',
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'Deep below the University, there is a dark place. Few people know of it: a broken web of ancient passageways and abandoned rooms. A young woman lives there, tucked among the sprawling tunnels of the Underthing, snug in the heart of this forgotten place.',
    isbn: '9780756411336',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3b"),
    __v: 0
  },
  imprint: ' Gollancz, 2011.',
  status: 'Loaned',
  _id: new ObjectId("63b46f855ab0689e7cec3a48"),
  due_back: 2023-01-03T18:10:13.784Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: "The Wise Man's Fear (The Kingkiller Chronicle, #2)",
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'Picking up the tale of Kvothe Kingkiller once again, we follow him into exile, into political intrigue, courtship, adventure, love and magic... and further along the path that has turned Kvothe, the mightiest magician of his age, a legend in his own time, into Kote, the unassuming pub landlord.',
    isbn: '9788401352836',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3a"),
    __v: 0
  },
  imprint: ' Gollancz, 2015.',
  status: 'Maintenance',
  _id: new ObjectId("63b46f855ab0689e7cec3a49"),
  due_back: 2023-01-03T18:10:13.784Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'Test Book 1',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 1',
    isbn: 'ISBN111111',
    genre: [ [Object], [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3e"),
    __v: 0
  },
  imprint: 'New York Tom Doherty Associates, 2016.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a4a"),
  due_back: 2023-01-03T18:10:13.784Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'The Name of the Wind (The Kingkiller Chronicle, #1)',
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'I have stolen princesses back from sleeping barrow kings. I burned down the town of Trebon. I have spent the night with Felurian and left with both my sanity and my life. I was expelled from the University at a younger age than most people are allowed in. I tread paths by moonlight that others fear to speak of during day. I have talked to Gods, loved women, and written songs that make the minstrels weep.',
    isbn: '9781473211896',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a39"),
    __v: 0
  },
  imprint: 'London Gollancz, 2014.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a47"),
  due_back: 2023-01-03T18:10:13.783Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'Test Book 1',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 1',
    isbn: 'ISBN111111',
    genre: [ [Object], [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3e"),
    __v: 0
  },
  imprint: 'New York Tom Doherty Associates, 2016.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a4b"),
  due_back: 2023-01-03T18:10:13.785Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'The Name of the Wind (The Kingkiller Chronicle, #1)',
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'I have stolen princesses back from sleeping barrow kings. I burned down the town of Trebon. I have spent the night with Felurian and left with both my sanity and my life. I was expelled from the University at a younger age than most people are allowed in. I tread paths by moonlight that others fear to speak of during day. I have talked to Gods, loved women, and written songs that make the minstrels weep.',
    isbn: '9781473211896',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a39"),
    __v: 0
  },
  imprint: 'Imprint XXX2',
  status: 'Maintenance',
  _id: new ObjectId("63b46f855ab0689e7cec3a50"),
  due_back: 2023-01-03T18:10:13.786Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'Test Book 2',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 2',
    isbn: 'ISBN222222',
    genre: [],
    _id: new ObjectId("63b46f855ab0689e7cec3a3f"),
    __v: 0
  },
  imprint: 'New York, NY Tom Doherty Associates, LLC, 2015.',
  status: 'Maintenance',
  _id: new ObjectId("63b46f855ab0689e7cec3a4e"),
  due_back: 2023-01-03T18:10:13.785Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'The Slow Regard of Silent Things (Kingkiller Chronicle)',
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'Deep below the University, there is a dark place. Few people know of it: a broken web of ancient passageways and abandoned rooms. A young woman lives there, tucked among the sprawling tunnels of the Underthing, snug in the heart of this forgotten place.',
    isbn: '9780756411336',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3b"),
    __v: 0
  },
  imprint: 'Imprint XXX3',
  status: 'Maintenance',
  _id: new ObjectId("63b46f855ab0689e7cec3a51"),
  due_back: 2023-01-03T18:10:13.786Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'Test Book 2',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 2',
    isbn: 'ISBN222222',
    genre: [],
    _id: new ObjectId("63b46f855ab0689e7cec3a3f"),
    __v: 0
  },
  imprint: 'New York, NY Tom Doherty Associates, LLC, 2015.',
  status: 'Loaned',
  _id: new ObjectId("63b46f855ab0689e7cec3a4f"),
  due_back: 2023-01-03T18:10:13.786Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'Test Book 1',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 1',
    isbn: 'ISBN111111',
    genre: [ [Object], [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3e"),
    __v: 0
  },
  imprint: 'New York Tom Doherty Associates, 2016.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a4c"),
  due_back: 2023-01-03T18:10:13.785Z,
  __v: 0
}
New BookInstance: {
  book: {
    title: 'Test Book 2',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 2',
    isbn: 'ISBN222222',
    genre: [],
    _id: new ObjectId("63b46f855ab0689e7cec3a3f"),
    __v: 0
  },
  imprint: 'New York, NY Tom Doherty Associates, LLC, 2015.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a4d"),
  due_back: 2023-01-03T18:10:13.785Z,
  __v: 0
}
BOOKInstances: {
  book: {
    title: 'The Slow Regard of Silent Things (Kingkiller Chronicle)',
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'Deep below the University, there is a dark place. Few people know of it: a broken web of ancient passageways and abandoned rooms. A young woman lives there, tucked among the sprawling tunnels of the Underthing, snug in the heart of this forgotten place.',
    isbn: '9780756411336',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3b"),
    __v: 0
  },
  imprint: ' Gollancz, 2011.',
  status: 'Loaned',
  _id: new ObjectId("63b46f855ab0689e7cec3a48"),
  due_back: 2023-01-03T18:10:13.784Z,
  __v: 0
},{
  book: {
    title: "The Wise Man's Fear (The Kingkiller Chronicle, #2)",
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'Picking up the tale of Kvothe Kingkiller once again, we follow him into exile, into political intrigue, courtship, adventure, love and magic... and further along the path that has turned Kvothe, the mightiest magician of his age, a legend in his own time, into Kote, the unassuming pub landlord.',
    isbn: '9788401352836',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3a"),
    __v: 0
  },
  imprint: ' Gollancz, 2015.',
  status: 'Maintenance',
  _id: new ObjectId("63b46f855ab0689e7cec3a49"),
  due_back: 2023-01-03T18:10:13.784Z,
  __v: 0
},{
  book: {
    title: 'Test Book 1',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 1',
    isbn: 'ISBN111111',
    genre: [ [Object], [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3e"),
    __v: 0
  },
  imprint: 'New York Tom Doherty Associates, 2016.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a4a"),
  due_back: 2023-01-03T18:10:13.784Z,
  __v: 0
},{
  book: {
    title: 'The Name of the Wind (The Kingkiller Chronicle, #1)',
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'I have stolen princesses back from sleeping barrow kings. I burned down the town of Trebon. I have spent the night with Felurian and left with both my sanity and my life. I was expelled from the University at a younger age than most people are allowed in. I tread paths by moonlight that others fear to speak of during day. I have talked to Gods, loved women, and written songs that make the minstrels weep.',
    isbn: '9781473211896',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a39"),
    __v: 0
  },
  imprint: 'London Gollancz, 2014.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a47"),
  due_back: 2023-01-03T18:10:13.783Z,
  __v: 0
},{
  book: {
    title: 'Test Book 1',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 1',
    isbn: 'ISBN111111',
    genre: [ [Object], [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3e"),
    __v: 0
  },
  imprint: 'New York Tom Doherty Associates, 2016.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a4b"),
  due_back: 2023-01-03T18:10:13.785Z,
  __v: 0
},{
  book: {
    title: 'The Name of the Wind (The Kingkiller Chronicle, #1)',
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'I have stolen princesses back from sleeping barrow kings. I burned down the town of Trebon. I have spent the night with Felurian and left with both my sanity and my life. I was expelled from the University at a younger age than most people are allowed in. I tread paths by moonlight that others fear to speak of during day. I have talked to Gods, loved women, and written songs that make the minstrels weep.',
    isbn: '9781473211896',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a39"),
    __v: 0
  },
  imprint: 'Imprint XXX2',
  status: 'Maintenance',
  _id: new ObjectId("63b46f855ab0689e7cec3a50"),
  due_back: 2023-01-03T18:10:13.786Z,
  __v: 0
},{
  book: {
    title: 'Test Book 2',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 2',
    isbn: 'ISBN222222',
    genre: [],
    _id: new ObjectId("63b46f855ab0689e7cec3a3f"),
    __v: 0
  },
  imprint: 'New York, NY Tom Doherty Associates, LLC, 2015.',
  status: 'Maintenance',
  _id: new ObjectId("63b46f855ab0689e7cec3a4e"),
  due_back: 2023-01-03T18:10:13.785Z,
  __v: 0
},{
  book: {
    title: 'The Slow Regard of Silent Things (Kingkiller Chronicle)',
    author: {
      first_name: 'Patrick',
      family_name: 'Rothfuss',
      date_of_birth: 1973-06-06T00:00:00.000Z,
      _id: new ObjectId("63b46f7f5ab0689e7cec3a28"),
      __v: 0
    },
    summary: 'Deep below the University, there is a dark place. Few people know of it: a broken web of ancient passageways and abandoned rooms. A young woman lives there, tucked among the sprawling tunnels of the Underthing, snug in the heart of this forgotten place.',
    isbn: '9780756411336',
    genre: [ [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3b"),
    __v: 0
  },
  imprint: 'Imprint XXX3',
  status: 'Maintenance',
  _id: new ObjectId("63b46f855ab0689e7cec3a51"),
  due_back: 2023-01-03T18:10:13.786Z,
  __v: 0
},{
  book: {
    title: 'Test Book 2',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 2',
    isbn: 'ISBN222222',
    genre: [],
    _id: new ObjectId("63b46f855ab0689e7cec3a3f"),
    __v: 0
  },
  imprint: 'New York, NY Tom Doherty Associates, LLC, 2015.',
  status: 'Loaned',
  _id: new ObjectId("63b46f855ab0689e7cec3a4f"),
  due_back: 2023-01-03T18:10:13.786Z,
  __v: 0
},{
  book: {
    title: 'Test Book 1',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 1',
    isbn: 'ISBN111111',
    genre: [ [Object], [Object] ],
    _id: new ObjectId("63b46f855ab0689e7cec3a3e"),
    __v: 0
  },
  imprint: 'New York Tom Doherty Associates, 2016.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a4c"),
  due_back: 2023-01-03T18:10:13.785Z,
  __v: 0
},{
  book: {
    title: 'Test Book 2',
    author: {
      first_name: 'Jim',
      family_name: 'Jones',
      date_of_birth: 1971-12-16T00:00:00.000Z,
      _id: new ObjectId("63b46f855ab0689e7cec3a31"),
      __v: 0
    },
    summary: 'Summary of test book 2',
    isbn: 'ISBN222222',
    genre: [],
    _id: new ObjectId("63b46f855ab0689e7cec3a3f"),
    __v: 0
  },
  imprint: 'New York, NY Tom Doherty Associates, LLC, 2015.',
  status: 'Available',
  _id: new ObjectId("63b46f855ab0689e7cec3a4d"),
  due_back: 2023-01-03T18:10:13.785Z,
  __v: 0
}

Do you have any supporting links, references, or citations?

I believe others have also faced this issue as reported here:

There seems to be a genuine issue with the script although I am just a beginner and can not say this with absolute confidence.

But further reading on this error took to the below links which talk about this issue and possible fixes in detail:

Looks like some timing issue and hence people are suggesting to wait and sync properly.

If there is some understanding issue for beginners, I would request the page to be updated accordingly.

Do you have anything more you want to share?

As I am just a beginner and wanted to focus on the main article, I just added some wait in the script by putting this code before async.series():

var waitTill = new Date(new Date().getTime() + 5 * 1000);
while(waitTill > new Date()){}

This adds a delay of 5 sec and the connections are properly established and hence the script executes like a charm.

Ref: https://stackoverflow.com/questions/14249506/how-can-i-wait-in-node-js-javascript-l-need-to-pause-for-a-period-of-time

MDN metadata

Page report details * Folder: `en-us/learn/server-side/express_nodejs/mongoose` * MDN URL: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/mongoose * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/learn/server-side/express_nodejs/mongoose/index.md * Last commit: https://github.com/mdn/content/commit/1f4c6bc8ea56c9ee2aa0087ce69b89343bc66fd9 * Document last modified: 2022-12-19T10:07:55.000Z
hamishwillee commented 1 year ago

Thanks for reporting. Mongoose updated to version 6 from version 5, so the behaviour changed. I've updated the tutorial and worked version of tutorial to use mongoose 6. That should remove the warnings, and MAY remove the buffering timeout.

hamishwillee commented 1 year ago

Fixed. Thanks for reporting