Transferring data between environments

I know that this functionality isn’t core functionality to admin, but it is a problem we are encountering and I was wondering if anyone has a good suggestion.

We work with data in development environments, and typically when we have finished handling a new type/set of data we would then deploy the code to staging (and then production). One thing that we could really do with is the ability to copy a load of Mongo documents from a local instance to a staging instance, and then from a staging instance onto production.

ideally we would have a smart bulk action which would say something like “Copy to production” or “Copy to staging”, can anyone think of how we could do this?

Expected behavior

Please describe here the behavior you are expecting.

Actual behavior

What is the current behavior?

Failure Logs

Please include any relevant log snippets, if necessary.

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version:
  • Sequelize Version:
  • Database Dialect:
  • Database Version:
  • Project Name:

Hi @BenPeddie :wave: welcome to our community.

I suggest you to have a look about smart action on our documentation:
https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions

And put the type option to bulk:
https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions#available-smart-action-options

When the smart action will have been created, you can just override this route

router.post('/actions/your-action-name', (req, res) => {
  // Here contact your staging / production server
});

Let me know if it help.

1 Like

Hi Arnaud,

Thanks for this - really appreciate it!

I was wondering if you have any advice for handling multiple connections in the backend? Is there a way to create a locally scoped connection?

Cheers

Hi @BenPeddie,

For your multiple connections subject, you can have a look to this conversation.
I hope this will help!

PS: we try to keep one conversation for one subject to make this forum as helpful as possible for the community :wink:

Awesome - that is for sql - do you have any examples with mongodb? I didn’t add to that conversation as it didn’t really solve my problem, but will do in future for certain!