In index.js , where does injectDB() come from?

Checking various docs I see no mention of this function. I’m not actually up to the section yet, just looking at the code and was curious.

Hey @Stuart_76776

This is a method that is created on the DAO classes. Please visit any of the following file commentsDAO.js, usersDAO.js or moviesDAO.js and at the top of the Class declaration it is the first method created.

export default class CommentsDAO {
  static async injectDB(conn) {
    if (comments) {
    try {
      comments = await conn.db(process.env.MFLIX_NS).collection("comments")
    } catch (e) {
      console.error(`Unable to establish collection handles in userDAO: ${e}`)
1 Like

Got it now. Thank you !

1 Like