Skip to content

Add short section on mongodump / mongorestore early in the course #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mikeckennedy opened this issue Jul 4, 2017 · 13 comments
Open
Assignees

Comments

@mikeckennedy
Copy link
Owner

No description provided.

@larsrinn
Copy link

Yes definitely. Do you describe how to do that anywhere? I am struggling to set up the database like you have it. So I'm not able to follow even the simplest querying videos. This is really frustrating...

@larsrinn
Copy link

OK, I didn't read the instructions in the README.md in the data-folder not thouroughly enough. So I missed the unzipping part. Maybe a more detailed readme would be a good idea

@mikeckennedy
Copy link
Owner Author

Hi @lmr2391 this is covered in depth in the deployment section. I think there is another part (performance?) where it's covered. But yeah, doing it sooner is a good idea. Thanks!

@larsrinn
Copy link

larsrinn commented Jul 21, 2017 via email

@ariedallas
Copy link

ariedallas commented Sep 13, 2017

Hi Michael - Enjoying the course so far. I spent about 30 mins trying to "import" the bookstore db into Mongo. I agree with @lmr2391 that a brief mention earlier during the querying videos section would be great. I will check out the later vids as you mention to see if it helps. Or office hours.

Here's what I was attempting:
mongorestore --drop --db bookstore /foo/bar/.../mongodb-for-python-developers/data/bookstore

Then later after reading the errors I tried:
usr/local/Cellar/mongodb/3.4.7/bin/mongorestore --db; _bookstore; /path/to/bookstore

Typing in 'mongorestore' in the CLI (while mongo is running) gives me:
$ mongorestore
2017-09-13T16:01:31.109-0400 E QUERY [thread1] ReferenceError: mongostore is not defined :

@mikeckennedy
Copy link
Owner Author

Hi @thomasoflight, thanks for the feedback. I'll definitely add a video on restoring the DB but it will be a few weeks until I can get to it. However, your first attempt:

mongorestore --drop --db bookstore /.../data/bookstore

Actually looks like it would be fine if mongorestore was in the path.

@ariedallas
Copy link

ariedallas commented Sep 14, 2017

I'll keep playing with it - appreciate your quick thread response.

--UPDATE--It works!

  1. I added "/usr/local/Cellar/mongodb/3.4.7/bin" to my path.
  2. I ran the command from the bash shell and not from the mongo shell. I'd been confusedly running it inside the shell.

Computers are about context: infuriating, but oddly exciting...

@mountwe
Copy link

mountwe commented Oct 3, 2019

I'm just starting this course in October 2019. Like others I spent several hours, along with several backtracks in course sessions, to try to get bookstore loaded. I guess I had been running mongorestore from the mongo shell, not from the terminal - I'm on Windows 10. I just did that and it worked like a charm.
I had done that before but what I was doing wrong was not using "bookstore" in place of DATABASE, i.e. I was typing
mongorestore --drop --db DATABASE /.../data/bookstore

I realized that DATABASE looks like a parameter to be replaced but since I had not been able to load bookstore, it made no sense to me to drop bookstore.

Other than that, the course is great!

@mikeckennedy
Copy link
Owner Author

Sorry for the difficulty. I added this as an issue and I'll add a video for folks earlier in the course. Doesn't help you much, but pays it forward.

You're now all set and good to go? Glad you're enjoying the course (outside this bit :) ).

@tmaslowski
Copy link

Hello from the future (Mongo 4.x)

If you want to follow along with the videos this would be a great opportunity to show the ease of using RoboMongo. Don't use this as a crutch, be sure to learn how to replicate what you're doing in the GUI at the cmd line level.

If you are having issues installing the bookstore db you may want to give Studio 3T (RoboMongo) a shot. Assuming mongo is running connect using the GUI, it's straight forward just make sure the localhost port matches.

First right-click on the db's in the left panel, and select 'Add Database', name it 'bookstore' for this specific example.
Second, right-click on the new 'bookstore' directory in the list of dbs and select 'Add Collection'

After that import the extracted file folder. Your options will include .csv, .json, .bson etc

In this example select '.bson', read the description and you'll see it matches the contents of the extracted file folder.

On the main screen use the GUI to find the bookstore folder path, and once found press the green triangle (execute)

You can watch the status of the import in the lower-left panel but it should be pretty fast.
Expand the bookstore directory and you should see the collection.

Now you can go into the cmd prompt enter mongo and start breaking things!

@mikeckennedy
Copy link
Owner Author

Hey, that's interesting. Can you add the whole DB that way or just collection by collection? Because with mongorestore you can restore a DB with 20 collections in one shot. I just haven't tried robomongo.

However, later in the course, we do discuss using robomongo for queries and visualizing the db.

@tmaslowski
Copy link

Unfortunately, I can't speak to RoboMongo/Studio 3T's ability to consume a DB with 20 collections. The newest version does allow for the DB's in this course to be easily imported at the DB level or as described, collection by collection.

Once unzipped the directory structure populates the DB and collections.

Really enjoy both Podcasts! Can I suggest you check out a company called OpenTrons, they are using python to run laboratory liquid handling robotics as well as customized automation. They're a great example of how coding can be a superpower!

robomongo

@mikeckennedy
Copy link
Owner Author

Thanks. Those import options are nice. But I now realize why I didn't know about those.

  • The free mongodb UI tool is Robo3T (formerly RoboMongo)
  • The paid premium product is Studio 3T.

I'm not against using paid products (we do use PyCharm pro for example in some courses). But we don't use it in this course.

And thanks for listening to the podcasts! Much appreciated. I'll check out OpenTrons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants