From the course: MongoDB Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Solution: Create app

Solution: Create app

(upbeat music) - [Instructor] Here I have two documents that will fit into our orders collection. I'm going to just copy these two. Inside MongoDB, the first thing I'm going to do is I'm going to create a new database called order_app. Inside this database, I'm going to create a collection called orders and I'm going to insert my two documents in here. And we'll put these inside an array, so now I'll just paste. I'll close the array and I'll close the method. All right, cool, we've got these two documents inserted in the orders collection. If you want to check they're there, just run db.orders.findOne or .find. Okay, great. Now, I don't know for sure what common queries might look like for this app but I think it's safe to assume that we'll often be querying by a username and time or by a restaurant name and time. So the first index I'm going to create is on the username and time. Now, I don't actually have a…

Contents