This recipe is about creating test data for some of the recipes in this chapter and also for the later chapters in this book. We will demonstrate how to load a CSV file into a Mongo database using the import utility. This is a basic recipe; if readers are aware of the data-import process, they might just download the CSV file (pincodes.csv
) from the book's site, load it in the collection by themselves, and skip the rest of the recipe. We will use the default database test, and the collection will be named postalCodes
.
The data used here is for postal codes in India. Download the pincodes.csv
file from the book's website. The file is a CSV file with 39,732 records; it should create 39,732 documents upon successful import. We need to have the Mongo server up and running. Refer to the Single node installation of MongoDB recipe in Chapter 1, Installing and Starting the MongoDB Server, for instructions on how to start the server. The server should begin listening...