Guest User

Untitled

a guest
Dec 6th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import mongoengine
  2.  
  3. #mongodb://<dbuser>:<dbpassword>@ds135519.mlab.com:35519/a-task-v2
  4.  
  5. host = "ds135519.mlab.com"
  6. port = 35519
  7. db_name = "a-task-v2"
  8. user_name = "admin"
  9. password = "admin"
  10.  
  11.  
  12. def connect():
  13. mongoengine.connect(db_name, host=host, port=port, username=user_name, password=password)
  14.  
  15. def list2json(l):
  16. import json
  17. return [json.loads(item.to_json()) for item in l]
  18.  
  19.  
  20. def item2json(item):
  21. import json
  22. return json.loads(item.to_json())
Add Comment
Please, Sign In to add comment