Hello, I am writing to report a catastrophic issue that I have encountered when working with MongoDB Atlas functions and triggers this morning that resulted in Atlas making my function vanish completely:
After spending 3 days building and testing my function I proceeded to configuring a scheduled trigger for it. I filled out all the relevant form fields and then selected my aforementioned Atlas function from the select list. I was given an error that my trigger was incorrectly named (indeed, the words in the name had spaces in between).
So I then corrected the issue by adding “_” to the spaces, thus making the name into a snake case. Which I think made the trigger name identical to the function name. I then again selected the function from the drop down list and clicked the button to save the trigger.
I received a new error saying that
function with ID '654cc4f08e21ce521ecd6806' does not exist.
Terrified, I went to check the function list and indeed it was gone from the function list as well. Curiously, the dropdown inside the trigger creation form that shows the functions available for selection still showed the function but everytime I tried to save the trigger with the function I received the same error.
While I have never seen the MongoDB backend, my intuition tells me that MongoDB saves triggers and functions in the same collection and the following system failure on the MongoDb’s part has happened:
- I tried to save the trigger with the same name as the function.
- Since both triggers and functions are probably saved in the same collection on MongoDB Atlas, the trigger overwrote the function with itself. (Probably they are both considered functions, but with different types described in their fields and they are never checked properly).
- The trigger then proceeded to attach a function to itself but could no longer find it with the given name and type “function” as it has just been replaced by the trigger itself.
This bug has cost me 3 days of work and testing and I must say it is very disconcerting as it makes me very much worried about the longevity and safety of the rest of the data that I entrust MongoDB Atlas with.