Advertisement
Guest User

Untitled

a guest
Oct 14th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. # Python, Mongo, pymongo
  2. # -*- coding: utf-8 -*-
  3.  
  4. from pymongo import MongoClient
  5. import uuid
  6.  
  7. SAMPLE_ID = '61C74C27-EB0B-F242-9ED6-D8185B5BA084'
  8. MONGO_USERNAME = 'mongoUserName'
  9. MONGO_PASS = 'mongoPass'
  10. MONGO_URI = 'mongodb://{}:{}@localhost:27017/'.format(MONGO_USERNAME, MONGO_PASS)
  11.  
  12.  
  13. client = MongoClient(MONGO_URI)
  14. db = client['db-name']
  15. collection = db['collection-name']
  16.  
  17. for item in collection.find({"another-field-name": uuid.UUID(SAMPLE_ID)}):
  18. print item['field-name']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement