Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. import pymongo
  2. import sys
  3.  
  4. connection = pymongo.Connection("mongodb://localhost", safe=True)
  5.  
  6. db=connection.nooora
  7. coll = db.nooracollection
  8.  
  9.  
  10.  
  11. yourjson = {"name":"noora"}
  12. try:
  13. coll.insert(yourjson)
  14.  
  15. except:
  16. print "Unexpected error:", sys.exc_info()[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement