How to Use Pymongo and Search for Data

Last modified by Leon Poon on 2018/12/24 20:28

First, set up a virtualenv.

Make sure that your mongo server is running.

In the virtualenv, install pymongo, then try out this .py file in the virtualenv.

from pymongo import MongoClient
client = MongoClient()
db = client['test-database']
collection = db['test-collection']
print(collection.find_one({'my_key': 'some value'}))

If you don't have data yet, you can store some.

You can also follow tutorial.

Created by Leon Poon on 2018/12/24 17:48


If you're a new XWiki user, check out the Getting Started Guide.

Need help?

If you need help with XWiki you can contact: