MongoDB for Developers with Python Transcripts
Chapter: MongoDB's shell and native query syntax
Lecture: Concept: Connecting to MongoDB with the shell

Login or purchase this course to watch this video and the rest of the course contents.
0:01 So let's review the main concepts around using the shell. Remember you just typed mongo enter
0:06 and it will connect your local default, everything default port, default local host, no account etc, and once we're connected, we'll be in here,
0:16 and it'll say connected to the server, what version of the shell, what version of the server, 3.4.4 is the latest at the time of this recording,
0:23 but maybe not at the time you are watching it, like all things that are server's, newer is better.
0:27 Ok, so first thing that we might want to do is say what databases are here, and we do that with the show dbs command, we hit enter,
0:33 and it shows you the various databases that are listed. Then next we want to activate one,
0:38 so that we can issue commands to it through the db.collection or other high level operations,
0:43 so we'd say in this case let's work with talk_Python, so we'd use talk_Python. And it'll say great, we switch to database talk_Python,
0:51 and in you're wondering you can always trying as you saw me do db enter and it will say talk_Python, cool, and then,
0:56 we could say well what collections exist in talk_Python? This is actually pretty straightforward, the document design I think is pretty interesting
1:02 but there's not many collections, so we have episodes, guest, reviews and then while developing it,
1:09 I turned on profiling to see where it was slow and where it was fast, where I need indexes, we'll talk more about that near the end of the course.
1:15 So we have these four collections, and now if we want to find an episode we'd say db.episodes.find and give it some search,
1:24 or sort, or something to that effect. So this is how we get started and connect with the shell.


Talk Python's Mastodon Michael Kennedy's Mastodon