To make sure your MongoDB instance is running on Linux, run the following command from your terminal:
If a mongod instance is running, you will see something like:
Import the sample data into the inventory
collection.
From your system shell or command prompt, use the mongoimport tool to insert the sample documents into the inventory
collection in the test
database. mongoimport is packaged with MongoDB and will be in the /bin
directory of the MongoDB repository.
By default, mongoimport
will import data into an instance of MongoDB on localhost
, port 27017
. To import data into a MongoDB instance running on a different host or port, specify the hostname or port by including the --host and --port options.
Use the --drop option to drop the collection if it already exists. This ensures that the collection will only contain the data you are importing.
TIP
For non-Atlas instances, replace the <user>
and <password>
placeholders in the example with your MongoDB username and password. For all instances, update the --file
path to point to wherever you have saved your copy of the product inventory database.
No comments:
Post a Comment