Load File with mongoimport
¶
You can use mongoimport
to import data
from a JSON
or a CSV
file into MongoDB Atlas cluster.
Considerations¶
mongoimport
uses strict mode representation for certain BSON types.
Procedure¶
The following tutorial uses mongoimport
to
load data from a JSON
file to an Atlas cluster:
1
Set up a database user in the target Atlas cluster.¶
To run mongoimport
to write to Atlas cluster, you
must specify a database user that has readWrite privileges in the database
into which to import data.
For example, a user with Atlas admin
role provides these privileges.
If no such user exists, create the user:
- In the Security section of the left navigation, click Database Access. The Database Users tab displays.
- Click Add New Database User.
- Add an Atlas admin user.
2
Open the connect dialog.¶
From the Clusters view, click Connect for the Atlas cluster into which you want to migrate data.
3
Update IP Access List.¶
If the host where you will run mongoimport
is not in the
IP Access List, update the list.
You can specify either:
- The public IP address of the server on which
mongoimport
will run, or - If set up for VPC peering, either the peer's VPC CIDR block (or a subnet) or the peer VPC