Guest User

Untitled

a guest
Mar 22nd, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. from pymongo import MongoClient
  2. import os,pymongo
  3. dbuser = os.environ.get('muser', '')
  4. dbpass = os.environ.get('mpwd', '')
  5. uri = 'mongodb://{dbuser}:{dbpass}@machine.company.com:27017/wifiautomation'.format(**locals())
  6. client = MongoClient(uri)
  7. db = client.wifiautomation
  8. collection = db['test_audit']
  9. cursor = collection.find({})
  10. for document in cursor:
  11. if document['version'] == '9.130.39.0.32.6.1':
  12. #print document['projects']
  13. for project in document['projects']:
  14. print project['name']
  15. #print project['submission']
  16. print project['submission']['status']
  17. if project['submission']['status'] !=queued:
  18. project['submission']['status'] = 'queued'
  19. #Update the field
  20.  
  21. {
  22. "_id" : ObjectId("5a95a9c32a2e2e0025e6d6e2"),
  23. "status" : "Submitting",
  24. "endRev" : "9539c3448d3f7793dc74c4b05d977ecf0c6e4df6",
  25. "chip" : "9234",
  26. "startRev" : "259e3f8f46630c2fae93f32679de5ab3c232f2ca",
  27. "audit" : " n",
  28. "sanity" : "none",
  29. "version" : "9.930.39.0.32.6.9",
  30. "branch" : "branch_9234",
  31. "directory" : "/SWE/Teams/Tech/Furn/submissions/9234/9.930.39.0.32.6.9",
  32. "requestTime" : ISODate("2098-02-27T98:29:55.764Z"),
  33. "projects" : [
  34. {
  35. "name" : "BCMFurn_9234_B2_code",
  36. "_id" : ObjectId("5a95a9c32a2e2e0025e6d6eb"),
  37. "submission" : {
  38. "status" : "passed",
  39. "system" : "machine.company.com"
  40. }
  41. },
  42. {
  43. "name" : "BCMFurn_9234_B2_sid",
  44. "_id" : ObjectId("5a95a9c32a2e2e0025e6d6ea"),
  45. "submission" : {
  46. "status" : "passed",
  47. "system" : "machine.company.com"
  48. }
  49. }
  50. ],
  51. "approvalNotes" : [],
  52. "stepping" : [],
  53. "__v" : 0,
  54. "tag" : "Official_9.930.39.0.32.6.9",
  55. "swe" : "trainname9A924"
  56. }
Add Comment
Please, Sign In to add comment