'script to query data from mongodb and insert some data in mysql

I have a MongoDB database that I need to query the user and their ID field.

In MongoDB I have a collection called account, which has an array type field called associations and inside associations I have the userId field, I need to check if the user ID is equal to the userId field.

If it is true, I need to create this user in my mysql database, bringing the respective data from Mongo's user collection and bringing the account ID field to a field called accountId direct in my user.

Any idea how to build a script like this?

We are developing in Graphql with Node.js



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source