Skip to content

Instantly share code, notes, and snippets.

View prakashthegyan's full-sized avatar

Gyan Prakash Tripathi prakashthegyan

View GitHub Profile
table.find_one({"name":'Gyan'})
import datetime
new_posts = [{"name": "Mike",
"username": "latestpost!",
"date": datetime.datetime(2009, 11, 12, 11, 14)},
{"name": "Eliot",
"title": "onceAgain",
"text": "and pretty easy too!",
"date": datetime.datetime(2009, 11, 10, 10, 45)}]
final = table.insert_many(new_posts)
post = {"_id": 'qwertyui123456',
'username': 'someone',
'name':'Gyan',
'address':'Somewhere in India'}
post_id = table.insert_one(post).inserted_id
post_id
first_instance['name']
first_instance.keys()
table.find_one()
table=db.customers
table.count_documents({}) #gives the number of documents in the table
db.list_collection_names()
db = client.sample_analytics
client.list_database_names()