Jun-28-2019, 12:47 AM
Managed to solve my issue.
import pymongo mng_client = pymongo.MongoClient('localhost', 27017) mng_db = mng_client['UNSdatabase'] # Replace mongo db name collection_name = 'UNS_Collection2' # Replace mongo db collection name db_cm = mng_db[collection_name] # Get the data from JSON file with open(r'D:\path\example_2.json', 'r') as data_file: data_json = json.load(data_file) #Insert Data db_cm.remove() db_cm.insert(data_json) # Query data db_cm.UNS_Collection2.find().pretty()