Node.js cant create user in MongoDB Atlas

Hi, I’m following a node.js tutorial and having trouble creating a user in MongoDB Atlas.
It’s connecting fine using just the db URI but once I try to create a user it fails with
“(node:64425) UnhandledPromiseRejectionWarning: MongooseError: Operation users.insertOne() buffering timed out after 10000ms”

The node.js command that tries to create the user is
new User({
username: profile.displayName,
googleId: profile.id
}).save().then((newUser) => {
console.log('new user created: ’ + newUser);
});

I’d appreciate some help.THanks.

3 Likes

I am also facing a similar kind of issue.

2 Likes

I am not sure you can do that on Atlas in a free account. I may be wrong.

Did you solve this issue?

Standard Mongo API createUser cannot be used to create database user on Atlas. You may consult

for more information.

However, you may use the Atlas API, https://docs.atlas.mongodb.com/reference/api/database-users-create-a-user to create database user. But as Jack_Woehr mentioned, this might also not work on free tier. For example, you do not have access to server logs on the free tier.

2 Likes