Copy functions to new database

I’ve been searching through the forums and Google, but can’t seem to find a straight forward answer to this question:

I have two databases in Atlas: one production and one testing. We’ve created a bunch of Atlas functions and HTTP endpoints on our testing database and everything is working well. Now, we want to transfer them all over to our production database to start deploying our new app. However, I can’t find an easy way to do this without copying and pasting every function and recreating them on our production database.

What is the easiest way to transfer or copy functions, HTTP endpoints and triggers between databases in Atlas?

Hey @Noora_Chahine,

Just for clarification regarding the “two databases” - Are you referring to two databases within the same cluster or are you referring to two clusters? If 2 clusters, then are both of your clusters in the same Project?, Or do they belong to different Projects within the same MongoDB Organisation?

Note: An organization can contain multiple projects.

If your clusters/databases are within the same Project, then it’s relatively straightforward to make the necessary changes. All you need to do is edit the function and update the database and collection names accordingly. This should allow you to proceed smoothly without any major hindrances. If you have trouble doing so, please let us know.

Since HTTP Endpoints and Triggers utilize the Atlas function in the background, the process should be relatively seamless.

Look forward to hearing from you.


@Kushagra_Kesav Thanks for the reply, but unfortunately, they’re on two different clusters under two different projects. I’m guessing there’s no way to just export them and import them between projects? :frowning:

Hey @Noora_Chahine,

Yes, I guess you will need to manually transfer them over to a different project.