Skip to content

Instantly share code, notes, and snippets.

@vijayanandrp
Last active November 24, 2017 13:39
Show Gist options
  • Save vijayanandrp/2429c44e5825743eb565ea56af2e4e80 to your computer and use it in GitHub Desktop.
Save vijayanandrp/2429c44e5825743eb565ea56af2e4e80 to your computer and use it in GitHub Desktop.
Import sample Json to MongoDB in Windows - https://informationcorners.com/pymongo-wrapper

Download a sample dataset or json from Github restaurants-dataset.json

restaurants-dataset.json

type the follwing command in command prompt

  mongoimport --db test --collection restaurants --drop --file "C:\Users\vp\Downloads\restaurants-dataset.json"

output looks like this in below

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.

PS C:\Users\vp> mongoimport --db test --collection restaurants --drop --file "C:\Users\vp\Downloads\restaurants-dataset.json"
2017-11-23T17:54:58.225+0530    connected to: localhost
2017-11-23T17:54:58.233+0530    dropping: test.restaurants
2017-11-23T17:55:01.203+0530    [##################......] test.restaurants     8.96MB/11.3MB (79.2%)
2017-11-23T17:55:02.257+0530    [########################] test.restaurants     11.3MB/11.3MB (100.0%)
2017-11-23T17:55:02.258+0530    imported 25359 documents
PS C:\Users\vp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment