GitHub - mongodb/docs-assets at drivers (original) (raw)

MongoDB Driver Documentation Assets

The restaurants.json dataset contains 10 documents of the form:

{ "_id" : , "name" : , "contact" : { "phone" : "email" : "location" : [ , ] }, "stars" : int, "categories" : "grades" : , }

Import DataSet

Note: The MongoDB deployment to which you wish to import the data must be running.

  1. Download and save the restaurants.json dataset.
  2. In the terminal shell or command prompt, use mongoimport (ormongoimport.exe on Windows) to insert the documents. For example, the following mongoimport connects to a mongod instance running on localhost on port number 27017.
    mongoimport --db test --collection restaurants --drop --file
    Note: If mongoimport is not in your path, either update the path or specify the full path to the executable.
    To import to a MongoDB deployment running on a different host or port, specify --host and --port options in your mongoimport command. See mongoimportfor details on available options.