I’m trying to add index creation to our devops pipeline and I have succeeded in creating one in all of our non prod environments using the atlas cli via bash script in the pipeline using the clusters indexes command described here - https://www.mongodb.com/docs/atlas/cli/stable/command/atlas-clusters-indexes-create/. The issue I have is that on repeated runs of this script, once the index has been created I get a 500 error and the pipeline fails. Is there a way to check if an index exists on the atlas cli before creating one or a different way of doing this which enables checking before creation?
Hello, welcome to the MongoDB community.
I tried looking for an API for a GET of indexes and it currently doesn’t exist. What you can do is connect to the cluster and validate the existing indexes or try to handle the error. Maybe it would be a good idea to open an idea at https://feedback.mongodb.com/
Thanks for the response, much appreciated, I suspected it didn’t exist I was just double checking myself. I think I’ll handle the error in the script and then open it up as a suggestion.
Okay, if it helped, mark it as solved, so other people will benefit when they search for the same topic. I’m available for you.