MongoDB with Async Python Transcripts
Chapter: Deployment
Lecture: Importing Data Introduction for Production MongoDB

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We want some data in our production MongoDB, right? And we already talked about how to install the data, import the data into the server.
0:12 And over on the GitHub repo, we have these steps here. Well, the exact same thing applies for our data on the server.
0:19 So let's go copy that URL there and go over to our server. Now, in order to get the data downloaded,
0:30 don't have a web browser so we're going to do a wget this and see it downloaded it and let's call that .zip and there it is. We want to unzip.
0:50 We don't have unzip do we? apt install unzip and while we're here just for symmetry let's do that one as well. Excellent.
1:00 again. Oh, look, it works. So here we have all of our files. Now in order to restore
1:10 this, we need to run this Mongo restore --drop command. But because our pass our
1:19 server requires username and password and SSL, the command is not so simple. So what
1:24 we're going to do is we're going to say Mongo restore --drop --DB this
1:30 slash local directory, the directory we're in, but we're going to specify the connection
1:35 string, pi pi database user, password host port, SSL, use SSL or TLS and allow self signed certificates. All right, let's give it a shot.
1:54 And of course, that's going to need to be in quotes to escape it out of the shell. Try again. Here we go. Awesome. So let's do our Mongo shell again.
2:09 And just make sure that we have data here. Use, well, first of all, let's show DBs. Oh, PyPI is there.
2:17 pi pi show collections. Excellent. Let's say db dot packages. Let's do a users, something
2:28 a little shorter users dot find limit one. Pretty. They have it. Here's our to capture
2:37 one that we saw before right at the top. Excellent. Our data is imported. Not the easiest thing
2:44 to guess here because somewhere in between the options, these are the options, and the
2:52 working directory we have to put the connection string now that it's not just localhost and 27017. Not hard, you just got to know how to do it.
3:01 So here's the way that we restore the data into the production database server.


Talk Python's Mastodon Michael Kennedy's Mastodon