Skip to content

Instantly share code, notes, and snippets.

@kuwakino
Last active September 8, 2020 12:58
Show Gist options
  • Save kuwakino/5f1eb3610bc721f8a6b10ca84b395ea3 to your computer and use it in GitHub Desktop.
Save kuwakino/5f1eb3610bc721f8a6b10ca84b395ea3 to your computer and use it in GitHub Desktop.
Jupyter notebook + MongoDB on Win10

Installations to run Jupyter notebooks from https://github.com/thedatasociety/lab-mongodb on Windows 10.

IDE: VS Code - https://code.visualstudio.com/

Installations:

  1. Install VS Code;
  2. Install Python;
  3. Install MongoDB;
    • https://www.mongodb.com/;
    • include the path for VS Code have access to mongo;
      • (Windows) System Properties [window] > Environment Variables [button] > Path [option] > Edit [button] > New [button] > "C:\Program Files\MongoDB\Server\4.4\bin" [paste];
  4. (OPTIONAL) MongoDB Compass Community;
    • IDE to access mongodb instance - optional but usefull;
    • MongoDB installation asks for install it;
  5. Install Pyhton extension on VS Code;
    • ms-python.python
  6. Install MongoDB tools;
  7. Jupyter notebooks could require some python libraries;
    • on VS Code > Terminal [menu] > New Terminal [option];
    • execute the pip installations;
      • e.g.:
        • pip install pymongo;
        • pip install pprintpp;
  8. For Exercicio 2 [pt-br].ipynb it needs to import the database:
    • bsondump is part of MongoDB tools (installed on Step 7);
    • execute bsondump on ..\lab-mongodb-master\resources\datasets\quick-mongo-atlas-datasets\dump\sample_mflix
    • bsondump --outFile=movies.json movies.bson
    • copy the file movies.json to ..\lab-mongodb\labs (same directory from restaurants.json from Exercicio 1 [pt-br].ipynb)
  9. After generated the movies.json import to mongodb:
    • adding as a step on the notebook:
      • mongoimport --db exercicio2 --collection movies --drop --file ./movies.json
@hmonda
Copy link

hmonda commented Sep 7, 2020

O Python.extension já tráz o Jupiter Notebook.

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