Skip to content

Instantly share code, notes, and snippets.

@Linus-Albertus
Last active May 26, 2019 10:56
Show Gist options
  • Save Linus-Albertus/67a1e9c3143208b3652a6f5a4f28180e to your computer and use it in GitHub Desktop.
Save Linus-Albertus/67a1e9c3143208b3652a6f5a4f28180e to your computer and use it in GitHub Desktop.
[pmongo regex consult] Consult a mongodb database with pymongo #pymongo #mongodb
from pymongo import MongoClient
client = MongoClient()
db = client.your_mongo_db
responses = db.your_mongodb_collection.find( { 'field_name': {'$regex' : "regular_expresion", "$options" : "i"} } )
for response in responses:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment