Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created August 27, 2020 07:31
Show Gist options
  • Save lakshay-arora/7a86d0bafe8b43d51e0dfcfd02b6f80a to your computer and use it in GitHub Desktop.
Save lakshay-arora/7a86d0bafe8b43d51e0dfcfd02b6f80a to your computer and use it in GitHub Desktop.
# create weekly demand collection
database.create_collection("weekly_demand")
# get collection weekly_demand
weekly_demand_collection = database.get_collection("weekly_demand")
# open the weekly_demand json file
with open("weekly_demand.json") as f:
file_data = json.load(f)
# insert the data into the collection
weekly_demand_collection.insert_many(file_data)
# get the count of total data points
weekly_demand_collection.find().count()
# >> 456548
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment