I am getting exactly the same error. Tried few options… but nothing worked.
would love to get this sorted out.
This is an old article, and implementation has changed a little bit, so here’s the working code.
const mongo = await MongoMemoryServer.create();
const mongoDBURL = mongo.getUri();
The rest is the same. Here’s the link to the official documentation
This article saved my day
That’s great to read, Zevik! Welcome to the Auth0 Community.
How did it help you the most?
Is there anything that you’d like to change on the content or anything else that you’d like to see covered?
Hello, all!
This blog post has been deprecated.
Find the latest guidance on how to implement authorization in Express.js applications by following our “Node.js API Authorization By Example” guides from the Auth0 Developer Center Resources. You can find the guidance on both JavaScript and TypeScript!
Thanks sneekyjs. I run into the same issue with the latest mongo-memory server 18 and mongo 6. Here is my curated code:
const startDatabase = async () => {
// replaced tutorial statement`const mongo = new MongoMemoryServer();`
// to work with mongodb-memory-server version ^18.15.1
const mongo = await MongoMemoryServer.create();
// replaced tutorial statement `await mongo.getConnectionString();`
// since getConnectionString was deprecated in version ^18.15.1
const mongoDBURL = await mongo.getUri();
// replaced tutorial statement `... await MongoClient.connect(mongoDBURL, {useNewUrlParser: true});`
// since useNewUrlParser was deprecated in mongodb version ^6.0.0
const connection = await MongoClient.connect(mongoDBURL);
database = connection.db();
};