Show last authors
1 First, [[set up a virtualenv>>doc:Main.How to Create a VirtualEnv.WebHome]].
3 Make sure that your [[mongo server is running>>doc:Main.How to connect to mongo server.WebHome]].
5 [[In the virtualenv, install pymongo>>doc:Main.How to add libraries to a virtualenv.WebHome]], then try out this .py file [[in the virtualenv>>doc:Main.How to Run a Python Script in a VirtualEnv.WebHome]].
7 {{code language="python"}}
8 from pymongo import MongoClient
9 client = MongoClient()
10 db = client['test-database']
11 collection = db['test-collection']
12 print(collection.insert_one({'my_key': 'some value'}))
13 {{/code}}
15 The printout shows the ID assigned by mongodb to the data you stored. You can now try to [[look it up>>doc:Main.How to Use Pymongo and Search for Data.WebHome]].
17 You can also follow [[tutorial>>url:]].

Need help?

If you need help with XWiki you can contact: