Guest User

Untitled

a guest
Jul 19th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from mongate.connection import Connection
  2.  
  3. connection = Connection(
  4. 'example.com',
  5. 27080,
  6. https=True,
  7. auth=True,
  8. username='auth_username',
  9. password='auth_password'
  10. )
  11.  
  12. connection.connect_to_mongo('localhost', 27017)
  13.  
  14. db = connection.database_name
  15. collection = db.collection_name
  16.  
  17. batch = Batch(collection, connection)
  18.  
  19. batch.add_insert({
  20. 'batch_insert_1': 3,
  21. 'bar': 2
  22. })
  23.  
  24. batch.add_insert({
  25. 'batch_insert_2': 'banana',
  26. 'banana': 'apple'
  27. })
  28.  
  29. batch.add_insert({
  30. 'batch_insert_3': 29,
  31. 'bar': 2
  32. })
  33.  
  34. batch.execute()
Add Comment
Please, Sign In to add comment