Keyv + MongoDb TypeError The "id" argument must be of type string. Received undefined

516 views Asked by At

I'm getting this TypeError while using Keyv and Keyv/mongo.

throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined

When trying to create a new instance of Keyv, I pass in the connection string as instructed.

Given String Template From MongoDB Atlas MongoDB Atlas' Given Connection String Template

Keyv Documentation Example On Passing A Connection String Keyv Documentation Example Connection String Example


This is my code, I have inserted my password and database name into the given connection string as instructed.

const Keyv = require('keyv');
const keyv = new Keyv('mongodb+srv://Elitezen4531:***********@zen.hjg40.mongodb.net/Discord_Zen_Bot?retryWrites=true&w=majority');

keyv.on('error', err => console.error('Keyv connection error:', err));
0

There are 0 answers