samedi 26 décembre 2020

How to pass { useUnifiedTopology: true } to my unique Node.Js Mongoclient constructor

I was wondering how I could add the useUnifiedtopology property to my MongoClinet constructor. It should be an easy fix, just fitting it into the constructor, but the "constructor" I use does not have a "new" keyword and is not formatted the same as the documentation prefers (even though all constructors should have a "new" keyword), though everything still works perfectly fine. Here is my setup code (Node.Js, Express, MongoDB, no Mongoose):

const express = require('express');
const app = express();
const http = require('http').createServer(app);
const MongoClient = require('mongodb').MongoClient;
var mongodb = require('mongodb');
const url = "insertYourUrlHere"



Aucun commentaire:

Enregistrer un commentaire