Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import sys
  2. from pymongo import MongoClient
  3. try:
  4. conector = MongoClient("192.168.111.134",27017)
  5. bd = conector.curso
  6. coleccion = bd.libros
  7. """
  8. coleccion.insert_one({
  9. "titulo":"Lorem Ipsum",
  10. "año":2020,
  11. "metadatos":['Jhon Doe','Suspenso'],
  12. "tags":['ubicación','demo']
  13. })
  14. """
  15. print(coleccion.find_one({"tags":"demo"}))
  16. except Exception as e:
  17. sys.exit(e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement