1
+ # start-limit-method
2
+ results = restaurants .find ({ "cuisine" : "Italian" }).limit (5 )
3
+
4
+ async for restaurant in results :
5
+ print (restaurant ["name" ])
6
+ # end-limit-method
7
+
8
+ # start-limit-option
9
+ results = restaurants .find ({ "cuisine" : "Italian" }, limit = 5 )
10
+
11
+ async for restaurant in results :
12
+ print (restaurant ["name" ])
13
+ # end-limit-option
14
+
15
+ # start-sort-method
16
+ results = restaurants .find ({ "cuisine" : "Italian" }).sort ("name" , pymongo .ASCENDING )
17
+
18
+ async for restaurant in results :
19
+ print (restaurant ["name" ])
20
+ # end-sort-method
21
+
22
+ # start-sort-option
23
+ results = restaurants .find ({ "cuisine" : "Italian" }, sort = {"name" : pymongo .ASCENDING } )
24
+
25
+ async for restaurant in results :
26
+ print (restaurant ["name" ])
27
+ # end-sort-option
28
+
29
+ # start-skip
30
+ results = restaurants .find ({ "borough" : "Manhattan" }).skip (10 )
31
+
32
+ async for restaurant in results :
33
+ print (restaurant ["name" ])
34
+ # end-skip
35
+
36
+ # start-skip-option
37
+ results = restaurants .find ({ "borough" : "Manhattan" }, skip = 10 )
38
+
39
+ async for restaurant in results :
40
+ print (restaurant ["name" ])
41
+ # end-skip-option
42
+
43
+ # start-limit-sort-skip
44
+ results = restaurants .find ({ "cuisine" : "Italian" }) \
45
+ .sort ("name" , pymongo .ASCENDING ) \
46
+ .limit (5 ) \
47
+ .skip (10 )
48
+
49
+ async for restaurant in results :
50
+ print (restaurant ["name" ])
51
+ # end-limit-sort-skip
52
+
53
+ # start-limit-sort-skip-option
54
+ results = restaurants .find ({ "cuisine" : "Italian" }, limit = 5 , sort = {"name" : pymongo .ASCENDING }, skip = 10 )
55
+
56
+ async for restaurant in results :
57
+ print (restaurant ["name" ])
58
+ # end-limit-sort-skip-option
0 commit comments