{
  "id": "task_libraries:mongodb/javascript",
  "path": "/exapedia/javascript-mongodb-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "JavaScript MongoDB libraries",
  "answer": [
    {
      "t": "text",
      "text": "JavaScript MongoDB libraries connect Node.js applications to MongoDB and read and write its documents. An ODM or ORM layers schemas, validation, and typed models over the official driver's collection API. These libraries let apps and backend services store user records, content, and event data as JSON-like documents."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "JavaScript MongoDB libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#mongodb-node-js-driver",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F121"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F122"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F6"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F125"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F123"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#mongoose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F132"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F133"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F30"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F134"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#typeorm",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F147"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F151"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#typegoose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F164"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F56"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F168"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#mikroorm",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F179"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F80"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "npm"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#mongodb-node-js-driver",
          "label": [
            {
              "t": "fact",
              "fact": "F1"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F2"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Schema models",
            "TypeScript class mapping",
            "Transaction helpers"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#mongodb-node-js-driver",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F121"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F128"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F129"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#mongoose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F132"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F139"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F140"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F141"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#typeorm",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F147"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F157"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F158"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#typegoose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F164"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F171"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F172"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#mikroorm",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F179"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F186"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F187"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "mongodb-node-js-driver",
          "name": [
            {
              "t": "fact",
              "fact": "F121"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/mongodb/node-mongodb-native"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/mongodb"
            },
            {
              "label": "Docs",
              "href": "https://cdn.jsdelivr.net/npm/mongodb@7.9.0/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F10"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F122"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F6"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F124"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F123"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://cdn.jsdelivr.net/npm/mongodb@7.9.0/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F121"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F11"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F12"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "import { MongoClient } from 'mongodb';\n\nconst client = new MongoClient('mongodb://127.0.0.1:27017/library_example');\nawait client.connect();\nconst user = await client.db().collection('users').findOne({ name: 'Ada' });\nawait client.close();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://cdn.jsdelivr.net/npm/mongodb@7.9.0/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20applications%20using%20mongodb%20with%20MongoDB%20models%20connections%20references%20and%20transactions&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F121"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F126"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "mongoose",
          "name": [
            {
              "t": "fact",
              "fact": "F132"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/Automattic/mongoose"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/mongoose"
            },
            {
              "label": "Docs",
              "href": "https://cdn.jsdelivr.net/npm/mongoose@9.12.2/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F36"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F133"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F30"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F134"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://cdn.jsdelivr.net/npm/mongoose@9.12.2/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F132"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F37"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F38"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F145"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/payloadcms/payload",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F145"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "javascript",
              "code": "export const connect: Connect = async function connect(\n  this: MongooseAdapter,\n  options = {\n    hotReload: false,\n  },\n) {\n  const { hotReload } = options\n\n  if (this.url === false) {\n    return\n  }\n\n  if (typeof this.url !== 'string') {\n    throw new Error('Error: missing MongoDB connection URL.')\n  }\n\n  const urlToConnect = this.url\n\n  const connectionOptions: ConnectOptions = {\n    autoIndex: true,\n    ...this.connectOptions,\n  }\n\n  if (hotReload) {\n    connectionOptions.autoIndex = false\n  }\n\n  try {\n    if (!this.connection) {\n      this.connection = await mongoose.createConnection(urlToConnect, connectionOptions).asPromise()\n      if (this.afterCreateConnection) {\n        await this.afterCreateConnection(this)\n      }\n    }\n\n    await this.connection.openUri(urlToConnect, connectionOptions)\n\n    if (this.afterOpenConnection) {\n      await this.afterOpenConnection(this)\n    }\n\n    if (this.useAlternativeDropDatabase) {\n      if (this.connection.db) {\n        // Firestore doesn't support dropDatabase, so we monkey patch\n        // dropDatabase to delete all documents from all collections instead\n        this.connection.db.dropDatabase = async function (): Promise<boolean> {\n          const existingCollections = await this.listCollections().toArray()\n          await Promise.all(\n            existingCollections.map(async (collectionInfo) => {\n              const collection = this.collection(collectionInfo.name)\n              await collection.deleteMany({})\n            }),\n          )\n          return true\n        }\n        this.connection.dropDatabase = async function () {\n          await this.db?.dropDatabase()\n        }\n      }\n    }\n\n    // If we are running a replica set with MongoDB Memory Server,\n    // wait until the replica set elects a primary before proceeding\n    if (this.mongoMemoryServer) {\n      this.payload.logger.info(\n        'Waiting for MongoDB Memory Server replica set to elect a primary...',\n      )\n      await new Promise((resolve) => setTimeout(resolve, 2000))\n    }\n\n    if (!this.connection.getClient().options.replicaSet) {\n      this.transactionOptions = false\n      this.beginTransaction = defaultBeginTransaction()\n    }\n\n    if (!hotReload) {\n      if (process.env.PAYLOAD_DROP_DATABASE === 'true') {\n        this.payload.logger.info('---- DROPPING DATABASE ----')\n        await this.connection.dropDatabase()\n\n        this.payload.logger.info('---- DROPPED DATABASE ----')\n      }\n    }\n\n    if (this.ensureIndexes) {\n      await Promise.all(\n        [\n          ...this.payload.config.collections.flatMap((collection) => [\n            this.collections[collection.slug],\n            this.versions[collection.slug],\n          ]),\n          ...this.payload.config.globals.map((global) => this.versions[global.slug]),\n        ].map(async (model) => {\n          await model?.ensureIndexes()\n        }),\n      )\n    }\n\n    if (process.env.NODE_ENV === 'production' && this.prodMigrations) {\n      await this.migrate({ migrations: this.prodMigrations as unknown as Migration[] })\n    }\n  } catch (err) {\n    let msg = `Error: cannot connect to MongoDB.`\n\n    if (typeof err === 'object' && err && 'message' in err && typeof err.message === 'string') {\n      msg = `${msg} Details: ${err.message}`\n    }\n\n    this.payload.logger.error({\n      err,\n      msg,\n    })\n    throw new Error(`Error: cannot connect to MongoDB: ${msg}`)\n  }\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/payloadcms/payload/blob/5114b5bc293c526e4151bf4894e37fcef53c7cee/packages/db-mongodb/src/connect.ts#L9-L123",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F144"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20applications%20using%20mongoose%20with%20MongoDB%20models%20connections%20references%20and%20transactions&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F132"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "import mongoose from 'mongoose';\n\nawait mongoose.connect('mongodb://127.0.0.1:27017/library_example');\nconst User = mongoose.model('User', new mongoose.Schema({ name: String }));\nconst user = await User.findOne({ name: 'Ada' });\nawait mongoose.disconnect();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://cdn.jsdelivr.net/npm/mongoose@9.12.2/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "index.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F137"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "typeorm",
          "name": [
            {
              "t": "fact",
              "fact": "F147"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/typeorm/typeorm"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/typeorm"
            },
            {
              "label": "Docs",
              "href": "https://typeorm.io/docs/drivers/mongodb/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F154"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F150"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://typeorm.io/docs/drivers/mongodb/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F147"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F162"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F163"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/Outerbridgeio/Outerbridge",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F162"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "async initialize(AppDataSource: DataSource, componentNodes: IComponentNodesPool) {\n    this.deployedWorkflows = {}\n    this.AppDataSource = AppDataSource\n\n    const workflows = await this.AppDataSource.getMongoRepository(Workflow).find()\n    for (let i = 0; i < workflows.length; i += 1) {\n        const workflow = workflows[i]\n        if (workflow.deployed) {\n            try {\n                const flowDataString = workflow.flowData\n                const flowData: IReactFlowObject = JSON.parse(flowDataString)\n                const reactFlowNodes = flowData.nodes as IReactFlowNode[]\n                const reactFlowEdges = flowData.edges as IReactFlowEdge[]\n                const workflowShortId = workflow.shortId\n\n                const { graph, nodeDependencies } = constructGraphs(reactFlowNodes, reactFlowEdges)\n                const { faultyNodeLabels, startingNodeIds } = getStartingNode(nodeDependencies, reactFlowNodes)\n\n                // If there are faulty nodes and deployed is active, update deployed to false\n                if (faultyNodeLabels.length) {\n                    const body = {\n                        deployed: false\n                    }\n                    const updateWorkflow = new Workflow()\n                    Object.assign(updateWorkflow, body)\n\n                    AppDataSource.getMongoRepository(Workflow).merge(workflow, updateWorkflow)\n                    await AppDataSource.getMongoRepository(Workflow).save(workflow)\n\n                    continue\n                }\n\n                await this.add(startingNodeIds, graph, reactFlowNodes, componentNodes, workflowShortId)\n            } catch (e) {\n                throw new Error(`Error initializing workflow ${workflow.shortId}: ${e}`)\n            }\n        }\n    }\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/Outerbridgeio/Outerbridge/blob/e2aaae99205bd5620d7bd5f0b06094eba9fcd0ac/packages/server/src/DeployedWorkflowPool.ts#L39-L77",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F161"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=typeorm%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F147"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import 'reflect-metadata';\nimport { DataSource, Entity, Column, ObjectIdColumn } from 'typeorm';\nimport { ObjectId } from 'mongodb';\n\n@Entity()\nclass User {\n  @ObjectIdColumn() id!: ObjectId;\n  @Column() name!: string;\n}\nconst db = new DataSource({ type: 'mongodb', url: 'mongodb://127.0.0.1:27017/library_example', entities: [User] });\nawait db.initialize();\nconst user = await db.getMongoRepository(User).findOneBy({ name: 'Ada' });\nawait db.destroy();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://cdn.jsdelivr.net/npm/typeorm@1.1.3/data-source/DataSource.d.ts",
                  "label": [
                    {
                      "t": "text",
                      "text": "DataSource.d.ts"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F152"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "typegoose",
          "name": [
            {
              "t": "fact",
              "fact": "F164"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/typegoose/typegoose"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/@typegoose/typegoose"
            },
            {
              "label": "Docs",
              "href": "https://cdn.jsdelivr.net/npm/@typegoose/typegoose@13.5.0/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F60"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F56"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://cdn.jsdelivr.net/npm/@typegoose/typegoose@13.5.0/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F164"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F61"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F62"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F63"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F64"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/kpfromer/nestjs-typegoose",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F177"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "export function createTypegooseProviders(connectionName: string,\n                                         models: TypegooseClassWithOptions[] = []): FactoryProvider[] {\n\n  const connectionToken = getConnectionToken(connectionName);\n\n  const buildProvider = ({ name }: TypegooseClass, modelFactory: ModelFactory) => ({\n    provide: getModelToken(name),\n    useFactory: modelFactory,\n    inject: [connectionToken],\n  });\n\n  const createDiscriminatorFactoryFrom = (parentFactory: ModelFactory) =>\n    (discriminatorDefinition: TypegooseClass | TypegooseDiscriminator) => {\n      if (isTypegooseClass(discriminatorDefinition)) {\n        return buildProvider(discriminatorDefinition, (connection: Connection) =>\n          getDiscriminatorModelForClass(\n            parentFactory(connection),\n            discriminatorDefinition\n          )\n        );\n      }\n      const { typegooseClass, discriminatorId } = discriminatorDefinition;\n      return buildProvider(typegooseClass, (connection: Connection) =>\n        getDiscriminatorModelForClass(\n          parentFactory(connection),\n          typegooseClass,\n          discriminatorId\n        )\n      );\n    };\n\n  return models.reduce(\n    (providers, { typegooseClass, schemaOptions = {}, discriminators = [] }) => {\n\n      const modelFactory = (connection: Connection) => getModelForClass(\n        typegooseClass,\n        { existingConnection: connection, schemaOptions },\n      );\n\n      const modelProvider = buildProvider(typegooseClass, modelFactory);\n\n      const discriminatorProviders = discriminators.map(createDiscriminatorFactoryFrom(modelFactory));\n\n      return [...providers, modelProvider, ...discriminatorProviders];\n    },\n    [],\n  );\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/kpfromer/nestjs-typegoose/blob/de3b8690778967152155503baa5f226808d84cb5/src/typegoose.providers.ts#L17-L64",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20applications%20using%20%40typegoose/typegoose%20with%20MongoDB%20models%20connections%20references%20and%20transactions&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F164"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import 'reflect-metadata';\nimport mongoose from 'mongoose';\nimport { prop, getModelForClass } from '@typegoose/typegoose';\n\nclass User {\n  @prop({ type: () => String }) name?: string;\n}\nawait mongoose.connect('mongodb://127.0.0.1:27017/library_example');\nconst UserModel = getModelForClass(User);\nconst user = await UserModel.findOne({ name: 'Ada' });\nawait mongoose.disconnect();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://cdn.jsdelivr.net/npm/@typegoose/typegoose@13.5.0/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F169"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "mikroorm",
          "name": [
            {
              "t": "fact",
              "fact": "F179"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/mikro-orm/mikro-orm"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/@mikro-orm/mongodb"
            },
            {
              "label": "Docs",
              "href": "https://mikro-orm.io/docs/usage-with-mongo"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F83"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F80"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://mikro-orm.io/docs/usage-with-mongo",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F179"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F84"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F85"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F86"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F87"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F88"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F89"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F90"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F91"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F192"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/synzen/MonitoRSS",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "javascript",
              "code": "export async function disableFeed(orm: MikroORM, feedId: string, reason: string) {\n  try {\n    const repo = orm.em.getRepository(Feed)\n    await repo.nativeUpdate({\n      _id: new ObjectId(feedId)\n    }, {\n      disabled: reason\n    })\n  } catch (err) {\n    const errorMessage = `Failed to disable feed ${feedId}: ${(err as Error).message}`\n    log.error(errorMessage)\n    logDatadog('error', errorMessage, {\n      stack: (err as Error).stack\n    })\n  }\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/synzen/MonitoRSS/blob/b00857357305fc64455f59c915a26686dea869a2/services/discord-rest-listener/src/send-failure-notification.ts#L6-L21",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F191"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20applications%20using%20%40mikro-orm/mongodb%20with%20MongoDB%20models%20connections%20references%20and%20transactions&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F179"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "import { MikroORM, EntitySchema } from '@mikro-orm/mongodb';\n\nconst User = new EntitySchema({\n  name: 'User',\n  properties: {\n    _id: { type: 'ObjectId', primary: true },\n    name: { type: 'string' },\n  },\n});\nconst orm = await MikroORM.init({ entities: [User], dbName: 'library_example', clientUrl: 'mongodb://127.0.0.1:27017' });\nconst user = await orm.em.fork().findOne('User', { name: 'Ada' });\nawait orm.close();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://cdn.jsdelivr.net/npm/@mikro-orm/core@7.2.10/metadata/EntitySchema.d.ts",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F184"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which JavaScript MongoDB library should I use?",
      "a": [
        {
          "t": "text",
          "text": "The "
        },
        {
          "t": "link",
          "href": "#mongodb-node-js-driver",
          "label": [
            {
              "t": "text",
              "text": "MongoDB Node.js driver"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits apps that work with collections directly. "
        },
        {
          "t": "link",
          "href": "#mongoose",
          "label": [
            {
              "t": "text",
              "text": "Mongoose"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits apps that want schemas, validation, and document models. "
        },
        {
          "t": "link",
          "href": "#typegoose",
          "label": [
            {
              "t": "text",
              "text": "Typegoose"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits TypeScript projects that define Mongoose models as classes."
        }
      ]
    },
    {
      "q": "What is Mongoose?",
      "a": [
        {
          "t": "link",
          "href": "#mongoose",
          "label": [
            {
              "t": "text",
              "text": "Mongoose"
            }
          ]
        },
        {
          "t": "text",
          "text": " is an ODM that adds schemas, casting, validation, and document models to MongoDB. It also populates references between documents."
        }
      ]
    },
    {
      "q": "What is a Mongoose schema?",
      "a": [
        {
          "t": "text",
          "text": "A Mongoose schema defines the fields, types, and validation rules for the documents in a collection. "
        },
        {
          "t": "link",
          "href": "#mongoose",
          "label": [
            {
              "t": "text",
              "text": "Mongoose"
            }
          ]
        },
        {
          "t": "text",
          "text": " builds a model from each schema and casts values to the declared types."
        }
      ]
    },
    {
      "q": "How do I use MongoDB with TypeScript?",
      "a": [
        {
          "t": "link",
          "href": "#typegoose",
          "label": [
            {
              "t": "text",
              "text": "Typegoose"
            }
          ]
        },
        {
          "t": "text",
          "text": " maps decorated TypeScript classes to typed Mongoose models. "
        },
        {
          "t": "link",
          "href": "#mikroorm",
          "label": [
            {
              "t": "text",
              "text": "MikroORM"
            }
          ]
        },
        {
          "t": "text",
          "text": " and "
        },
        {
          "t": "link",
          "href": "#typeorm",
          "label": [
            {
              "t": "text",
              "text": "TypeORM"
            }
          ]
        },
        {
          "t": "text",
          "text": " map TypeScript entity classes to MongoDB documents."
        }
      ]
    },
    {
      "q": "Mongoose vs the MongoDB driver: which should I use?",
      "a": [
        {
          "t": "text",
          "text": "The "
        },
        {
          "t": "link",
          "href": "#mongodb-node-js-driver",
          "label": [
            {
              "t": "text",
              "text": "MongoDB Node.js driver"
            }
          ]
        },
        {
          "t": "text",
          "text": " works with collections, cursors, and transactions directly. "
        },
        {
          "t": "link",
          "href": "#mongoose",
          "label": [
            {
              "t": "text",
              "text": "Mongoose"
            }
          ]
        },
        {
          "t": "text",
          "text": " adds schemas and validation on top of it."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, mongodb",
      "display": "MongoDB Node.js Driver",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, mongodb",
      "display": "83.5M",
      "asOf": "2026-11-16"
    },
    "F3": {
      "label": "License, mongodb",
      "display": "Apache-2.0",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, mongodb",
      "display": "7.9.0",
      "asOf": "2026-11-17"
    },
    "F5": {
      "label": "Undated package release, mongodb",
      "display": "v7.9.0",
      "asOf": "2026-11-17"
    },
    "F6": {
      "label": "Repository stars, mongodb",
      "display": "10.2K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Connection pooling, mongodb",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Transactions, mongodb",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Install, mongodb",
      "display": "npm install mongodb",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "What it does, mongodb",
      "display": "Connects Node.js applications directly to MongoDB with the official driver.",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "strengths lead, mongodb",
      "display": "Reuses database connections",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "strengths, mongodb",
      "display": "Each MongoClient maintains connection pools for its servers.",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths lead, mongodb",
      "display": "Retries supported transaction failures",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths, mongodb",
      "display": "The Convenient Transaction API includes transaction retry handling.",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "limitations lead, mongodb",
      "display": "Transactions run operations sequentially",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "limitations, mongodb",
      "display": "Await each transaction operation instead of using Promise.all.",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations lead, mongodb",
      "display": "Core transactions need error handling",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations, mongodb",
      "display": "Implement retries yourself when using the Core API.",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "Quickstart, mongodb",
      "display": "import { MongoClient } from \"mongodb\";\n\n// Replace the uri string with your MongoDB deployment's connection string.\nconst uri = \"<connection string uri>\";\n\nconst client = new MongoClient(uri);\n\nasync function run() {\n  try {\n    \n    // Get the database and collection on which to run the operation\n    const database = client.db(\"sample_mflix\");\n    const movies = database.collection(\"movies\");\n\n    // Query for a movie that has the title 'The Room'\n    const query = { title: \"The Room\" };\n\n    const options = {\n      // Sort matched documents in descending order by rating\n      sort: { \"imdb.rating\": -1 },\n      // Include only the `title` and `imdb` fields in the returned document\n      projection: { _id: 0, title: 1, imdb: 1 },\n    };\n\n    // Execute query\n    const movie = await movies.findOne(query, options);\n\n    // Print the document returned by findOne()\n    console.log(movie);\n  } finally {\n    await client.close();\n  }\n}\nrun().catch(console.dir);\n\n",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "Project function, mongodb",
      "display": "private async database(url: string, options?: MongoClientOptions) {\n\t\tlet connectionString = url;\n\n\t\tif (!hasMongoProtocol(connectionString)) {\n\t\t\tconnectionString = `mongodb://${connectionString}`;\n\t\t}\n\n\t\tthis.mongoClient = await MongoClient.connect(connectionString, {\n\t\t\t...options\n\t\t});\n\n\t\treturn this.mongoClient.db();\n\t}\n",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Project function reference, mongodb",
      "display": "MongoJobRepository.ts · database()",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project repository, mongodb",
      "display": "agenda/agenda",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project stars, agenda/agenda",
      "display": "9.7K",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project push date, agenda/agenda",
      "display": "Nov 2026",
      "asOf": "2026-11-13"
    },
    "F25": {
      "label": "Library name, mongoose",
      "display": "Mongoose",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Monthly downloads, mongoose",
      "display": "35.2M",
      "asOf": "2026-11-16"
    },
    "F27": {
      "label": "License, mongoose",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F28": {
      "label": "Package release, mongoose",
      "display": "9.10.2",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "Undated package release, mongoose",
      "display": "v9.10.2",
      "asOf": "2026-11-17"
    },
    "F30": {
      "label": "Repository stars, mongoose",
      "display": "27.4K",
      "asOf": "2026-11-17"
    },
    "F31": {
      "label": "Connection pooling, mongoose",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F32": {
      "label": "Transactions, mongoose",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Reference population, mongoose",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Class model mapping, mongoose",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Install, mongoose",
      "display": "npm install mongoose",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "What it does, mongoose",
      "display": "Adds schemas, document models, and reference population to MongoDB applications.",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "strengths lead, mongoose",
      "display": "Loads referenced documents",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "strengths, mongoose",
      "display": "Use populate to replace references with documents from other collections.",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths lead, mongoose",
      "display": "Tracks rolled-back document changes",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths, mongoose",
      "display": "Connection.transaction restores change tracking after an aborted save.",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "limitations lead, mongoose",
      "display": "Queries can wait for connections",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "limitations, mongoose",
      "display": "Disable bufferCommands to expose missing connections instead of buffering calls.",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations lead, mongoose",
      "display": "Populated fields cannot filter parents",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations, mongoose",
      "display": "Filtering populated authors does not filter the matching stories.",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "Quickstart, mongoose",
      "display": "// getting-started.js\nconst mongoose = require('mongoose');\n\nmain().catch(err => console.log(err));\n\nasync function main() {\n  await mongoose.connect('mongodb://127.0.0.1:27017/test');\n\n  // use `await mongoose.connect('mongodb://user:password@127.0.0.1:27017/test');` if your database has auth enabled\n}\n\nconst kittySchema = new mongoose.Schema({\n  name: String\n});\n\nconst Kitten = mongoose.model('Kitten', kittySchema);\n\nconst silence = new Kitten({ name: 'Silence' });\nconsole.log(silence.name); // 'Silence'\n",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "Project function, mongoose",
      "display": "async function connect(\n  this: MongooseAdapter,\n  options = {\n    hotReload: false,\n  },\n) {\n  const { hotReload } = options\n\n  if (this.url === false) {\n    return\n  }\n\n  if (typeof this.url !== 'string') {\n    throw new Error('Error: missing MongoDB connection URL.')\n  }\n\n  const urlToConnect = this.url\n\n  const connectionOptions: ConnectOptions = {\n    autoIndex: true,\n    ...this.connectOptions,\n  }\n\n  if (hotReload) {\n    connectionOptions.autoIndex = false\n  }\n\n  try {\n    if (!this.connection) {\n      this.connection = await mongoose.createConnection(urlToConnect, connectionOptions).asPromise()\n      if (this.afterCreateConnection) {\n        await this.afterCreateConnection(this)\n      }\n    }\n\n    await this.connection.openUri(urlToConnect, connectionOptions)\n\n    if (this.afterOpenConnection) {\n      await this.afterOpenConnection(this)\n    }\n\n    if (this.useAlternativeDropDatabase) {\n      if (this.connection.db) {\n        // Firestore doesn't support dropDatabase, so we monkey patch\n        // dropDatabase to delete all documents from all collections instead\n        this.connection.db.dropDatabase = async function (): Promise<boolean> {\n          const existingCollections = await this.listCollections().toArray()\n          await Promise.all(\n            existingCollections.map(async (collectionInfo) => {\n              const collection = this.collection(collectionInfo.name)\n              await collection.deleteMany({})\n            }),\n          )\n          return true\n        }\n        this.connection.dropDatabase = async function () {\n          await this.db?.dropDatabase()\n        }\n      }\n    }\n\n    // If we are running a replica set with MongoDB Memory Server,\n    // wait until the replica set elects a primary before proceeding\n    if (this.mongoMemoryServer) {\n      this.payload.logger.info(\n        'Waiting for MongoDB Memory Server replica set to elect a primary...',\n      )\n      await new Promise((resolve) => setTimeout(resolve, 2000))\n    }\n\n    if (!this.connection.getClient().options.replicaSet) {\n      this.transactionOptions = false\n      this.beginTransaction = defaultBeginTransaction()\n    }\n\n    if (!hotReload) {\n      if (process.env.PAYLOAD_DROP_DATABASE === 'true') {\n        this.payload.logger.info('---- DROPPING DATABASE ----')\n        await this.connection.dropDatabase()\n\n        this.payload.logger.info('---- DROPPED DATABASE ----')\n      }\n    }\n\n    if (this.ensureIndexes) {\n      await Promise.all(\n        [\n          ...this.payload.config.collections.flatMap((collection) => [\n            this.collections[collection.slug],\n            this.versions[collection.slug],\n          ]),\n          ...this.payload.config.globals.map((global) => this.versions[global.slug]),\n        ].map(async (model) => {\n          await model?.ensureIndexes()\n        }),\n      )\n    }\n\n    if (process.env.NODE_ENV === 'production' && this.prodMigrations) {\n      await this.migrate({ migrations: this.prodMigrations as unknown as Migration[] })\n    }\n  } catch (err) {\n    let msg = `Error: cannot connect to MongoDB.`\n\n    if (typeof err === 'object' && err && 'message' in err && typeof err.message === 'string') {\n      msg = `${msg} Details: ${err.message}`\n    }\n\n    this.payload.logger.error({\n      err,\n      msg,\n    })\n    throw new Error(`Error: cannot connect to MongoDB: ${msg}`)\n  }\n}\n",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Project function reference, mongoose",
      "display": "connect.ts · connect()",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project repository, mongoose",
      "display": "payloadcms/payload",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project stars, payloadcms/payload",
      "display": "45.9K",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "Project push date, payloadcms/payload",
      "display": "Nov 2026",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "Library name, @typegoose/typegoose",
      "display": "Typegoose",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Monthly downloads, @typegoose/typegoose",
      "display": "1.2M",
      "asOf": "2026-11-16"
    },
    "F53": {
      "label": "License, @typegoose/typegoose",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "Package release, @typegoose/typegoose",
      "display": "13.5.0",
      "asOf": "2026-11-17"
    },
    "F55": {
      "label": "Undated package release, @typegoose/typegoose",
      "display": "v13.5.0",
      "asOf": "2026-11-17"
    },
    "F56": {
      "label": "Repository stars, @typegoose/typegoose",
      "display": "2.3K",
      "asOf": "2026-11-17"
    },
    "F57": {
      "label": "Reference population, @typegoose/typegoose",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F58": {
      "label": "Class model mapping, @typegoose/typegoose",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Install, @typegoose/typegoose",
      "display": "npm install @typegoose/typegoose mongoose@~9.9.5",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "What it does, @typegoose/typegoose",
      "display": "Defines Mongoose models through TypeScript classes and decorators.",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "strengths lead, @typegoose/typegoose",
      "display": "Defines models with TypeScript classes",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "strengths, @typegoose/typegoose",
      "display": "Use decorated class properties to build Mongoose models.",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "strengths lead, @typegoose/typegoose",
      "display": "Narrows populated reference types",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "strengths, @typegoose/typegoose",
      "display": "Use isDocument to check references before accessing populated fields.",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "limitations lead, @typegoose/typegoose",
      "display": "Requires legacy TypeScript decorators",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "limitations, @typegoose/typegoose",
      "display": "Enable experimentalDecorators; Stage 3 decorators are unsupported.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "limitations lead, @typegoose/typegoose",
      "display": "Needs care with esbuild",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "limitations, @typegoose/typegoose",
      "display": "Use a compiler that emits decorator metadata.",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "Quickstart, @typegoose/typegoose",
      "display": "import { prop, getModelForClass } from '@typegoose/typegoose';\nimport mongoose from 'mongoose';\n\nclass User {\n  @prop()\n  public name?: string;\n\n  @prop({ type: () => [String] })\n  public jobs?: string[];\n}\n\nconst UserModel = getModelForClass(User); // UserModel is a regular Mongoose Model with correct types\n\n(async () => {\n  await mongoose.connect('mongodb://localhost:27017/', { dbName: 'test' });\n\n  const { _id: id } = await UserModel.create({ name: 'JohnDoe', jobs: ['Cleaner'] });\n  const user = await UserModel.findById(id).exec();\n\n  console.log(user); // prints { _id: 59218f686409d670a97e53e0, name: 'JohnDoe', __v: 0 }\n})();\n",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "Project function, @typegoose/typegoose",
      "display": "export function createTypegooseProviders(connectionName: string,\n                                         models: TypegooseClassWithOptions[] = []): FactoryProvider[] {\n\n  const connectionToken = getConnectionToken(connectionName);\n\n  const buildProvider = ({ name }: TypegooseClass, modelFactory: ModelFactory) => ({\n    provide: getModelToken(name),\n    useFactory: modelFactory,\n    inject: [connectionToken],\n  });\n\n  const createDiscriminatorFactoryFrom = (parentFactory: ModelFactory) =>\n    (discriminatorDefinition: TypegooseClass | TypegooseDiscriminator) => {\n      if (isTypegooseClass(discriminatorDefinition)) {\n        return buildProvider(discriminatorDefinition, (connection: Connection) =>\n          getDiscriminatorModelForClass(\n            parentFactory(connection),\n            discriminatorDefinition\n          )\n        );\n      }\n      const { typegooseClass, discriminatorId } = discriminatorDefinition;\n      return buildProvider(typegooseClass, (connection: Connection) =>\n        getDiscriminatorModelForClass(\n          parentFactory(connection),\n          typegooseClass,\n          discriminatorId\n        )\n      );\n    };\n\n  return models.reduce(\n    (providers, { typegooseClass, schemaOptions = {}, discriminators = [] }) => {\n\n      const modelFactory = (connection: Connection) => getModelForClass(\n        typegooseClass,\n        { existingConnection: connection, schemaOptions },\n      );\n\n      const modelProvider = buildProvider(typegooseClass, modelFactory);\n\n      const discriminatorProviders = discriminators.map(createDiscriminatorFactoryFrom(modelFactory));\n\n      return [...providers, modelProvider, ...discriminatorProviders];\n    },\n    [],\n  );\n}\n",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Project function reference, @typegoose/typegoose",
      "display": "typegoose.providers.ts · createTypegooseProviders()",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Project repository, @typegoose/typegoose",
      "display": "kpfromer/nestjs-typegoose",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Project stars, kpfromer/nestjs-typegoose",
      "display": "287",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project push date, kpfromer/nestjs-typegoose",
      "display": "Nov 2026",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Library name, @mikro-orm/mongodb",
      "display": "MikroORM",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Monthly downloads, @mikro-orm/mongodb",
      "display": "223.8K",
      "asOf": "2026-11-16"
    },
    "F77": {
      "label": "License, @mikro-orm/mongodb",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "Package release, @mikro-orm/mongodb",
      "display": "7.2.10",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "Undated package release, @mikro-orm/mongodb",
      "display": "v7.2.10",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "Repository stars, @mikro-orm/mongodb",
      "display": "9.3K",
      "asOf": "2026-11-17"
    },
    "F81": {
      "label": "Transactions, @mikro-orm/mongodb",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "Install, @mikro-orm/mongodb",
      "display": "npm install @mikro-orm/mongodb@7.2.10 @mikro-orm/core@7.2.9",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "What it does, @mikro-orm/mongodb",
      "display": "Maps MongoDB documents to entities with change tracking and a unit of work.",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "strengths lead, @mikro-orm/mongodb",
      "display": "Groups entity changes for saving",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "strengths, @mikro-orm/mongodb",
      "display": "Create related entities and save their pending changes with flush.",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "strengths lead, @mikro-orm/mongodb",
      "display": "Loads related entities",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "strengths, @mikro-orm/mongodb",
      "display": "Use populate when fetching authors with their books.",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "limitations lead, @mikro-orm/mongodb",
      "display": "Transactions require a replica set",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "limitations, @mikro-orm/mongodb",
      "display": "Use a replica-set deployment before enabling MongoDB transactions.",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "limitations lead, @mikro-orm/mongodb",
      "display": "Implicit transactions are opt-in",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "limitations, @mikro-orm/mongodb",
      "display": "Enable implicitTransactions or use an explicit transactional block.",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "Quickstart, @mikro-orm/mongodb",
      "display": "import { defineEntity, p, MikroORM } from '@mikro-orm/mongodb';\n\nconst AuthorSchema = defineEntity({\n  name: 'Author',\n  properties: {\n    id: p.objectId().primary(),\n    name: p.string(),\n    books: () => p.oneToMany(Book).mappedBy('author'),\n  },\n});\nexport class Author extends AuthorSchema.class {}\nAuthorSchema.setClass(Author);\n\nconst BookSchema = defineEntity({\n  name: 'Book',\n  properties: {\n    id: p.objectId().primary(),\n    title: p.string(),\n    author: () => p.manyToOne(Author).inversedBy('books'),\n  },\n});\nexport class Book extends BookSchema.class {}\nBookSchema.setClass(Book);\n\nconst orm = await MikroORM.init({\n  entities: [Author, Book],\n  dbName: 'my-db',\n  clientUrl: 'mongodb://localhost:27017',\n});\n\nconst author = orm.em.create(Author, { name: 'Jon Snow' });\norm.em.create(Book, { title: 'My Life on The Wall', author });\nawait orm.em.flush();\n\nconst authors = await orm.em.find(\n  Author,\n  { name: /Jon/ },\n  {\n    populate: ['books'],\n  },\n);\n",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "Developer need",
      "display": "Direct MongoDB driver access",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "Why choose mongodb",
      "display": "reusable client connection pools",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Developer need in introduction",
      "display": "direct MongoDB driver access",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "When to consider mongoose",
      "display": "document models and population fit",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Developer need",
      "display": "Schemas and reference population",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Why choose mongoose",
      "display": "loads referenced documents",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Developer need in introduction",
      "display": "schemas and reference population",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "When to consider @typegoose/typegoose",
      "display": "TypeScript class definitions fit",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Developer need",
      "display": "Mongoose models from TypeScript classes",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Why choose @typegoose/typegoose",
      "display": "class-based model definitions",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Developer need in introduction",
      "display": "Mongoose models from TypeScript classes",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "When to consider mongoose",
      "display": "direct schema definitions fit",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Developer need",
      "display": "Related entities with grouped saves",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Why choose @mikro-orm/mongodb",
      "display": "unit-of-work flush",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Developer need in introduction",
      "display": "related entities with grouped saves",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Page introduction",
      "display": "JavaScript MongoDB libraries let application developers store and query application data.",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "FAQ: Which package provides the official Node.js driver?",
      "display": "mongodb is the official MongoDB driver for Node.js.",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "FAQ: Does each operation need a new client?",
      "display": "A MongoClient reuses connections through its built-in server pools.",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "FAQ: Can transaction operations run in parallel?",
      "display": "The Node.js driver does not support parallel operations within one transaction.",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "FAQ: Which transaction API includes retries?",
      "display": "The Convenient Transaction API incorporates retries for supported transaction errors.",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "FAQ: Why can Mongoose operations hang before connecting?",
      "display": "Mongoose buffers model calls; disabling bufferCommands exposes missing connections.",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "FAQ: Can populate filter parent documents?",
      "display": "Populating a story author cannot filter stories by that author’s properties.",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "FAQ: How does Mongoose handle transaction rollbacks?",
      "display": "Connection.transaction integrates transaction rollback with document change tracking.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: Does loadClass infer schema fields?",
      "display": "loadClass pulls methods, statics, and virtuals from an ES6 class.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: Which TypeScript decorators does Typegoose support?",
      "display": "Enable legacy experimentalDecorators; Stage 3 decorators are unsupported.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: How are populated Typegoose references narrowed?",
      "display": "Use isDocument or isDocumentArray before treating populated references as documents.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: What deployment supports MikroORM MongoDB transactions?",
      "display": "Its MongoDB transaction setup requires a replica set.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: Are MikroORM MongoDB implicit transactions enabled?",
      "display": "Implicit transactions are disabled by default; explicitly enable them when needed.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "Library name, mongodb",
      "display": "MongoDB Node.js driver",
      "asOf": "2026-11-20"
    },
    "F122": {
      "label": "Monthly downloads, mongodb",
      "display": "83.5M",
      "asOf": "2026-11-20"
    },
    "F123": {
      "label": "License, mongodb",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F124": {
      "label": "Package release, mongodb",
      "display": "7.9.0",
      "asOf": "2026-11-20"
    },
    "F125": {
      "label": "Package release date, mongodb",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F126": {
      "label": "Install, mongodb",
      "display": "npm install mongodb@7.9.0",
      "asOf": "2026-11-20"
    },
    "F127": {
      "label": "Quickstart, mongodb",
      "display": "import { MongoClient } from 'mongodb';\n\nconst client = new MongoClient('mongodb://127.0.0.1:27017/library_example');\nawait client.connect();\nconst user = await client.db().collection('users').findOne({ name: 'Ada' });\nawait client.close();\n",
      "asOf": "2026-11-20"
    },
    "F128": {
      "label": "Schema models, mongodb",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F129": {
      "label": "TypeScript class mapping, mongodb",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F130": {
      "label": "Transaction helpers, mongodb",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "Modeling and operating model, mongodb",
      "display": "Official MongoDB Node.js driver with native clients/databases/collections, BSON IDs, cursors, bulk operations, and session/transaction APIs. Its collection/server validation is distinct from an ODM client-side schema/model layer.",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "Library name, mongoose",
      "display": "Mongoose",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Monthly downloads, mongoose",
      "display": "35.2M",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "License, mongoose",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Package release, mongoose",
      "display": "9.12.2",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Package release date, mongoose",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Install, mongoose",
      "display": "npm install mongoose@9.12.2",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Quickstart, mongoose",
      "display": "import mongoose from 'mongoose';\n\nawait mongoose.connect('mongodb://127.0.0.1:27017/library_example');\nconst User = mongoose.model('User', new mongoose.Schema({ name: String }));\nconst user = await User.findOne({ name: 'Ada' });\nawait mongoose.disconnect();\n",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Schema models, mongoose",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "TypeScript class mapping, mongoose",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Transaction helpers, mongoose",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Modeling and operating model, mongoose",
      "display": "Schema/model ODM with casting, validation, document/query methods, references, and Mongoose connection transaction integration. Native loadClass maps methods/getters/statics, not TypeScript property-decorator field inference.",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Project function, mongoose",
      "display": "export const connect: Connect = async function connect(\n  this: MongooseAdapter,\n  options = {\n    hotReload: false,\n  },\n) {\n  const { hotReload } = options\n\n  if (this.url === false) {\n    return\n  }\n\n  if (typeof this.url !== 'string') {\n    throw new Error('Error: missing MongoDB connection URL.')\n  }\n\n  const urlToConnect = this.url\n\n  const connectionOptions: ConnectOptions = {\n    autoIndex: true,\n    ...this.connectOptions,\n  }\n\n  if (hotReload) {\n    connectionOptions.autoIndex = false\n  }\n\n  try {\n    if (!this.connection) {\n      this.connection = await mongoose.createConnection(urlToConnect, connectionOptions).asPromise()\n      if (this.afterCreateConnection) {\n        await this.afterCreateConnection(this)\n      }\n    }\n\n    await this.connection.openUri(urlToConnect, connectionOptions)\n\n    if (this.afterOpenConnection) {\n      await this.afterOpenConnection(this)\n    }\n\n    if (this.useAlternativeDropDatabase) {\n      if (this.connection.db) {\n        // Firestore doesn't support dropDatabase, so we monkey patch\n        // dropDatabase to delete all documents from all collections instead\n        this.connection.db.dropDatabase = async function (): Promise<boolean> {\n          const existingCollections = await this.listCollections().toArray()\n          await Promise.all(\n            existingCollections.map(async (collectionInfo) => {\n              const collection = this.collection(collectionInfo.name)\n              await collection.deleteMany({})\n            }),\n          )\n          return true\n        }\n        this.connection.dropDatabase = async function () {\n          await this.db?.dropDatabase()\n        }\n      }\n    }\n\n    // If we are running a replica set with MongoDB Memory Server,\n    // wait until the replica set elects a primary before proceeding\n    if (this.mongoMemoryServer) {\n      this.payload.logger.info(\n        'Waiting for MongoDB Memory Server replica set to elect a primary...',\n      )\n      await new Promise((resolve) => setTimeout(resolve, 2000))\n    }\n\n    if (!this.connection.getClient().options.replicaSet) {\n      this.transactionOptions = false\n      this.beginTransaction = defaultBeginTransaction()\n    }\n\n    if (!hotReload) {\n      if (process.env.PAYLOAD_DROP_DATABASE === 'true') {\n        this.payload.logger.info('---- DROPPING DATABASE ----')\n        await this.connection.dropDatabase()\n\n        this.payload.logger.info('---- DROPPED DATABASE ----')\n      }\n    }\n\n    if (this.ensureIndexes) {\n      await Promise.all(\n        [\n          ...this.payload.config.collections.flatMap((collection) => [\n            this.collections[collection.slug],\n            this.versions[collection.slug],\n          ]),\n          ...this.payload.config.globals.map((global) => this.versions[global.slug]),\n        ].map(async (model) => {\n          await model?.ensureIndexes()\n        }),\n      )\n    }\n\n    if (process.env.NODE_ENV === 'production' && this.prodMigrations) {\n      await this.migrate({ migrations: this.prodMigrations as unknown as Migration[] })\n    }\n  } catch (err) {\n    let msg = `Error: cannot connect to MongoDB.`\n\n    if (typeof err === 'object' && err && 'message' in err && typeof err.message === 'string') {\n      msg = `${msg} Details: ${err.message}`\n    }\n\n    this.payload.logger.error({\n      err,\n      msg,\n    })\n    throw new Error(`Error: cannot connect to MongoDB: ${msg}`)\n  }\n}\n",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Project source file, mongoose",
      "display": "packages/db-mongodb/src/connect.ts",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Project full_name, mongoose",
      "display": "payloadcms/payload",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Project stargazers_count, mongoose",
      "display": "45.9K",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Library name, typeorm",
      "display": "TypeORM",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Monthly downloads, typeorm",
      "display": "26.9M",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "License, typeorm",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Package release, typeorm",
      "display": "1.1.3",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Package release date, typeorm",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Install, typeorm",
      "display": "npm install typeorm@1.1.3 mongodb@7.9.0 reflect-metadata@0.2.2",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Quickstart, typeorm",
      "display": "import 'reflect-metadata';\nimport { DataSource, Entity, Column, ObjectIdColumn } from 'typeorm';\nimport { ObjectId } from 'mongodb';\n\n@Entity()\nclass User {\n  @ObjectIdColumn() id!: ObjectId;\n  @Column() name!: string;\n}\nconst db = new DataSource({ type: 'mongodb', url: 'mongodb://127.0.0.1:27017/library_example', entities: [User] });\nawait db.initialize();\nconst user = await db.getMongoRepository(User).findOneBy({ name: 'Ada' });\nawait db.destroy();\n",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Official description, typeorm",
      "display": "Maps classes and entities to MongoDB through a repository interface with basic MongoDB support.",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Quickstart source file, typeorm",
      "display": "data-source/DataSource.d.ts",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Schema models, typeorm",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "TypeScript class mapping, typeorm",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Transaction helpers, typeorm",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Modeling and operating model, typeorm",
      "display": "Class/entity repository interface with basic MongoDB support on Node driver7+. Its own Mongo-specific guide excludes RDBMS-only query/transaction methods; SQL feature parity is not assumed.",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Project function, typeorm",
      "display": "async initialize(AppDataSource: DataSource, componentNodes: IComponentNodesPool) {\n    this.deployedWorkflows = {}\n    this.AppDataSource = AppDataSource\n\n    const workflows = await this.AppDataSource.getMongoRepository(Workflow).find()\n    for (let i = 0; i < workflows.length; i += 1) {\n        const workflow = workflows[i]\n        if (workflow.deployed) {\n            try {\n                const flowDataString = workflow.flowData\n                const flowData: IReactFlowObject = JSON.parse(flowDataString)\n                const reactFlowNodes = flowData.nodes as IReactFlowNode[]\n                const reactFlowEdges = flowData.edges as IReactFlowEdge[]\n                const workflowShortId = workflow.shortId\n\n                const { graph, nodeDependencies } = constructGraphs(reactFlowNodes, reactFlowEdges)\n                const { faultyNodeLabels, startingNodeIds } = getStartingNode(nodeDependencies, reactFlowNodes)\n\n                // If there are faulty nodes and deployed is active, update deployed to false\n                if (faultyNodeLabels.length) {\n                    const body = {\n                        deployed: false\n                    }\n                    const updateWorkflow = new Workflow()\n                    Object.assign(updateWorkflow, body)\n\n                    AppDataSource.getMongoRepository(Workflow).merge(workflow, updateWorkflow)\n                    await AppDataSource.getMongoRepository(Workflow).save(workflow)\n\n                    continue\n                }\n\n                await this.add(startingNodeIds, graph, reactFlowNodes, componentNodes, workflowShortId)\n            } catch (e) {\n                throw new Error(`Error initializing workflow ${workflow.shortId}: ${e}`)\n            }\n        }\n    }\n}\n",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Project source file, typeorm",
      "display": "packages/server/src/DeployedWorkflowPool.ts",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Project full_name, typeorm",
      "display": "Outerbridgeio/Outerbridge",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Project stargazers_count, typeorm",
      "display": "194",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Library name, @typegoose/typegoose",
      "display": "Typegoose",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Monthly downloads, @typegoose/typegoose",
      "display": "1.2M",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "License, @typegoose/typegoose",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Package release, @typegoose/typegoose",
      "display": "13.5.0",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Package release date, @typegoose/typegoose",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Install, @typegoose/typegoose",
      "display": "npm install @typegoose/typegoose@13.5.0 mongoose@~9.9.5 reflect-metadata@0.2.2",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Quickstart, @typegoose/typegoose",
      "display": "import 'reflect-metadata';\nimport mongoose from 'mongoose';\nimport { prop, getModelForClass } from '@typegoose/typegoose';\n\nclass User {\n  @prop({ type: () => String }) name?: string;\n}\nawait mongoose.connect('mongodb://127.0.0.1:27017/library_example');\nconst UserModel = getModelForClass(User);\nconst user = await UserModel.findOne({ name: 'Ada' });\nawait mongoose.disconnect();\n",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Schema models, @typegoose/typegoose",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "TypeScript class mapping, @typegoose/typegoose",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Transaction helpers, @typegoose/typegoose",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Modeling and operating model, @typegoose/typegoose",
      "display": "Maps decorated TypeScript classes to ordinary typed Mongoose models and discriminator models. Current13.5 peer range is mongoose~9.9.5, narrower than separately selected latest Mongoose9.12.2; root model/connection instances must share a compatible peer.",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Project function, @typegoose/typegoose",
      "display": "export function createTypegooseProviders(connectionName: string,\n                                         models: TypegooseClassWithOptions[] = []): FactoryProvider[] {\n\n  const connectionToken = getConnectionToken(connectionName);\n\n  const buildProvider = ({ name }: TypegooseClass, modelFactory: ModelFactory) => ({\n    provide: getModelToken(name),\n    useFactory: modelFactory,\n    inject: [connectionToken],\n  });\n\n  const createDiscriminatorFactoryFrom = (parentFactory: ModelFactory) =>\n    (discriminatorDefinition: TypegooseClass | TypegooseDiscriminator) => {\n      if (isTypegooseClass(discriminatorDefinition)) {\n        return buildProvider(discriminatorDefinition, (connection: Connection) =>\n          getDiscriminatorModelForClass(\n            parentFactory(connection),\n            discriminatorDefinition\n          )\n        );\n      }\n      const { typegooseClass, discriminatorId } = discriminatorDefinition;\n      return buildProvider(typegooseClass, (connection: Connection) =>\n        getDiscriminatorModelForClass(\n          parentFactory(connection),\n          typegooseClass,\n          discriminatorId\n        )\n      );\n    };\n\n  return models.reduce(\n    (providers, { typegooseClass, schemaOptions = {}, discriminators = [] }) => {\n\n      const modelFactory = (connection: Connection) => getModelForClass(\n        typegooseClass,\n        { existingConnection: connection, schemaOptions },\n      );\n\n      const modelProvider = buildProvider(typegooseClass, modelFactory);\n\n      const discriminatorProviders = discriminators.map(createDiscriminatorFactoryFrom(modelFactory));\n\n      return [...providers, modelProvider, ...discriminatorProviders];\n    },\n    [],\n  );\n}\n",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Project source file, @typegoose/typegoose",
      "display": "src/typegoose.providers.ts",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Project full_name, @typegoose/typegoose",
      "display": "kpfromer/nestjs-typegoose",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Project stargazers_count, @typegoose/typegoose",
      "display": "287",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Library name, @mikro-orm/mongodb",
      "display": "MikroORM",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Monthly downloads, @mikro-orm/mongodb",
      "display": "223.8K",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "License, @mikro-orm/mongodb",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Package release, @mikro-orm/mongodb",
      "display": "7.2.10",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Package release date, @mikro-orm/mongodb",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Install, @mikro-orm/mongodb",
      "display": "npm install @mikro-orm/mongodb@7.2.10",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Quickstart, @mikro-orm/mongodb",
      "display": "import { MikroORM, EntitySchema } from '@mikro-orm/mongodb';\n\nconst User = new EntitySchema({\n  name: 'User',\n  properties: {\n    _id: { type: 'ObjectId', primary: true },\n    name: { type: 'string' },\n  },\n});\nconst orm = await MikroORM.init({ entities: [User], dbName: 'library_example', clientUrl: 'mongodb://127.0.0.1:27017' });\nconst user = await orm.em.fork().findOne('User', { name: 'Ada' });\nawait orm.close();\n",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Schema models, @mikro-orm/mongodb",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "TypeScript class mapping, @mikro-orm/mongodb",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Transaction helpers, @mikro-orm/mongodb",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Modeling and operating model, @mikro-orm/mongodb",
      "display": "Concrete MongoDB ORM driver with core entity definitions, identity map, unit-of-work tracking, managed entity updates, population, and native Mongo operations. Mongo transactions require replica sets and explicit demarcation or opt-in implicitTransactions; implicit transactions default off.",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Project function, @mikro-orm/mongodb",
      "display": "export async function disableFeed(orm: MikroORM, feedId: string, reason: string) {\n  try {\n    const repo = orm.em.getRepository(Feed)\n    await repo.nativeUpdate({\n      _id: new ObjectId(feedId)\n    }, {\n      disabled: reason\n    })\n  } catch (err) {\n    const errorMessage = `Failed to disable feed ${feedId}: ${(err as Error).message}`\n    log.error(errorMessage)\n    logDatadog('error', errorMessage, {\n      stack: (err as Error).stack\n    })\n  }\n}\n",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Project source file, @mikro-orm/mongodb",
      "display": "services/discord-rest-listener/src/send-failure-notification.ts",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Project full_name, @mikro-orm/mongodb",
      "display": "synzen/MonitoRSS",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Project stargazers_count, @mikro-orm/mongodb",
      "display": "1.3K",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best JavaScript MongoDB libraries MongoDB driver Mongoose Typegoose MikroORM code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
