MongoDB with Async Python Transcripts
Chapter: Document Databases
Lecture: A More Complex Query

Login or purchase this course to watch this video and the rest of the course contents.
0:00 To look at a more complicated query example, let's connect to a different database. This one doesn't come with the GitHub repo data.
0:09 This is just an example here in the slides. So we can say use bookstore and it says switch to DB bookstore, show collections because what is in here?
0:17 We have capital B book, capital P publishers and user. Something really important here, keep in mind, MongoDB is case sensitive, lowercase book
0:28 and uppercase book, not the same collection, totally, totally different things. Please don't have one and don't have both of those in there.
0:36 But you do have to realize that to talk to this one, you have to use the capital B. It's not just a presentation style. It's got exactly match.
0:45 All right. So here we can say we want to go to our books and we want to find, give us all of them.
0:51 But what our goal is, is to show a set of them, five. We want to do paging.
0:57 Like here's the first page of five, you want to say, ""Show me the next one,"" and then the next one, right?
1:02 Some kind of, ""Don't return a million records, but give a way to page through them. So we can say two things in combination.
1:09 First, skip three times the page size. So we're going to go to the third page, or fourth page, I guess. Zero-based.
1:18 We're going to go to the fourth page, and then from those, we still want to show, well, the page size five. So skip three times five and limit five.
1:26 That'll give us a list of these results of these books, five of them from the fourth page of page size five. Cool, right?


Talk Python's Mastodon Michael Kennedy's Mastodon