Guest User

Untitled

a guest
Oct 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. from pymongo import Connection
  2. uri = 'mongodb://neilkod:password@staff.mongohq.com:0001/earthquakes'
  3.  
  4.  
  5.  
  6. def get_count():
  7. connection = Connection(uri)
  8. db=connection.earthquakes
  9. conn = db.quakes
  10. foo = conn.find_one({'name':'earthquake'},{'count':1,'_id':0})
  11. val = int(foo['count'])
  12. connection.disconnect()
  13. return val
Add Comment
Please, Sign In to add comment