They are many ways of importing existing data into MongoDB. It depends on many factors, but the two most important ones are the source and data model. Our data sample is in JSON format, which is the format of the documents stored in MongoDB collections. The way MongoDB works is that behind the scenes, it encodes the JSON documents in a binary format—BSON (Binary JSON)—with some additional metadata, and when we query the collections, we get plain JSON objects. JSON is what we, JavaScript developers, naturally think of data that makes MongoDB extremely easy to work with; this is also the main reason why it is one of the most popular NoSQL databases.
How we model our collections is completely different from how we'd model our tables in a relational database. Data modeling in MongoDB is a big topic and it's out of the scope of this book; however, we...