Last modified by Leon Poon on 2021/03/23 13:17

From version 1.1
edited by Leon Poon
on 2018/12/24 09:48
Change comment: There is no comment for this version
To version 2.1
edited by Leon Poon
on 2018/12/24 12:28
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,16 +1,17 @@
1 -First, [[set up a virtualenv>>url:https://wiki.codepowered.com/wiki/How_to_Create_a_VirtualEnv]].
1 +First, [[set up a virtualenv>>doc:Main.How to Create a VirtualEnv.WebHome]].
2 2  
3 -Make sure that your [[mongo server is running>>url:https://wiki.codepowered.com/wiki/How_to_connect_to_mongo_server]].
3 +Make sure that your [[mongo server is running>>doc:Main.How to connect to mongo server.WebHome]].
4 4  
5 -[[In the virtualenv, install pymongo>>url:https://wiki.codepowered.com/wiki/How_to_add_libraries_to_a_virtualenv]], then try out this .py file [[in the virtualenv>>url:https://wiki.codepowered.com/wiki/How_to_Run_a_Python_Script_in_a_VirtualEnv]].
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]].
6 6  
7 -{{{from pymongo import MongoClient
7 +{{code language="python"}}
8 +from pymongo import MongoClient
8 8  client = MongoClient()
9 9  db = client['test-database']
10 10  collection = db['test-collection']
11 11  print(collection.find_one({'my_key': 'some value'}))
12 -}}}
13 +{{/code}}
13 13  
14 -If you don't have data yet, you can [[store some>>url:https://wiki.codepowered.com/wiki/How_to_Use_Pymongo_to_Store_Data]].
15 +If you don't have data yet, you can [[store some>>doc:Main.How to Use Pymongo to Store Data.WebHome]].
15 15  
16 16  You can also follow [[tutorial>>url:https://api.mongodb.com/python/current/tutorial.html%7Cthis]].