Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

pymongo add json to collection

client = MongoClient('localhost', 27017)
db = client['countries_db']
collection_currency = db['currency']

with open('currencies.json') as f:
    file_data = json.load(f)

collection_currency.insert(file_data) # pymongo < 3.0
collection_currency.insert_one(file_data) # pymongo >= 3.0
collection_currency.insert_many(file_data) # pymongo >= 3.0

client.close()
Comment

PREVIOUS NEXT
Code Example
Javascript :: chart js x axis start at 0 
Javascript :: jquery external script 
Javascript :: javascript get child element by class 
Javascript :: javascript sample list 
Javascript :: js check window active 
Javascript :: wait for element to load 
Javascript :: serialization and deserialization in javascript 
Javascript :: base64 to png nodejs 
Javascript :: split text and join in js 
Javascript :: get child routes using parent in angular 
Javascript :: test if property exists javascript 
Javascript :: javascript create array from 1 to n 
Javascript :: discord.js rich embed 
Javascript :: node uuid 
Javascript :: disable eslint 
Javascript :: buffer from base64 
Javascript :: how to fetch the all input element id value 
Javascript :: iterate object js 
Javascript :: javascript newline in alert box 
Javascript :: time calculator js 
Javascript :: javascript replace text within dom 
Javascript :: hardhat test 
Javascript :: check if message mentions users discord js 
Javascript :: jquery each loop 
Javascript :: if array has multiple duplicate value number them accordingly 
Javascript :: jquery select all except first child 
Javascript :: relaod the page in express 
Javascript :: input onenter go to next input field javascript 
Javascript :: javascript array group by 
Javascript :: js spread exclude property 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =