-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library attempts to create indexes #15
Comments
Hi, I got your point. |
Awesome thank you! |
I'm trying to reproduce the error but no luck currently - const {MongoClient} = require('mongodb');
const main = async () => {
const url = 'mongodb://localhost:27017/test';
const client = new MongoClient(url);
await client.connect();
const db = client.db();
await db.collection('testIndexes').createIndex(
{expirationDate: 1},
{expireAfterSeconds: 0}
);
await db.collection('testIndexes').createIndex(
{expirationDate: 1},
{expireAfterSeconds: 0}
);
};
main()
.then(() => {
console.log('All done');
})
.catch((err) => {
console.error('Error occurred: ', err.stack || err);
}); I get "All done" output (nodejs 10.x, [email protected]). @gregorskii could you help me with that? What error do you have? Do you have any thoughts about why did it happen? |
It says the user does not have the necessary permissions to add the indexes. I have added a custom role to mongo atlas with the ability to create indexes but it’s not working. My point though is that I don’t think the code necessarily needs the ability to create the index it just needs to be able to write. I can add the index manually. Shouldn’t it be optional that it creates them? Or that you can optionally not create them. |
I wanted to fully understand the situation to provide reasonable solution. |
Yep, enabled by default, but removed if defined would be great. Thanks so much! |
Implemented and published to npm as [email protected] |
Looks great! Thanks! |
Hey! Having the same issue, when setting the option createTtlIndex to false, then I will get the following error: before it was: Using Mongo Atlas and have readWrite rights to the user which I am connection to database. Any thoughts how to solve this? Thanks! |
Hey @jaankoppe, I don't have a chance to check it out particularly with Mongo Atlas right now but when |
Can this be optionally turned off?
The implementor could create the indexes manually if they were detailed in the readme.
This is currently failing for me with Atlas even when the writer has admin permissions, and the index exists. Looking into this more on my end.
Thanks
The text was updated successfully, but these errors were encountered: