File tree Expand file tree Collapse file tree 5 files changed +9
-28
lines changed Expand file tree Collapse file tree 5 files changed +9
-28
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,6 @@ Connect to MongoDB
25
25
Create a MongoClient </connect/mongoclient>
26
26
Choose a Connection Target </connect/connection-targets>
27
27
Specify Connection Options </connect/connection-options>
28
- Compress Network Traffic </connect/network-compression>
29
- Customize Server Selection </connect/server-selection>
30
- Stable API </connect/stable-api>
31
28
Limit Server Execution Time </connect/csot>
32
29
33
30
Overview
Original file line number Diff line number Diff line change 22
22
:titlesonly:
23
23
:maxdepth: 1
24
24
25
+ Specify a Query </crud/query/specify-query>
25
26
Find Documents </crud/query/find>
26
27
Specify Documents to Return </crud/query/specify-documents-to-return>
27
28
Specify Fields to Return </crud/query/project>
Original file line number Diff line number Diff line change
1
+ import pymongo
1
2
from pymongo import MongoClient
2
3
3
4
try :
4
- # start example code here
5
+ uri = "<connection string URI>"
6
+ client = MongoClient (uri )
5
7
6
- # end example code here
8
+ database = client ["<database name>" ]
9
+ collection = database ["<collection name>" ]
7
10
8
- client .admin .command ("ping" )
9
- print ("Connected successfully" )
11
+ # start example code here
10
12
11
- # other application code
13
+ # end example code here
12
14
13
15
client .close ()
14
16
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -12,5 +12,5 @@ Reference
12
12
Compatibility </reference/compatibility>
13
13
Third-Party Tools </reference/third-party-tools>
14
14
Upgrade Guides </reference/upgrade>
15
- Migration Guides </reference/migrate >
15
+ Migration Guides </reference/migration >
16
16
Previous Versions </reference/previous-versions>
You can’t perform that action at this time.
0 commit comments