File tree Expand file tree Collapse file tree 1 file changed +28
-27
lines changed Expand file tree Collapse file tree 1 file changed +28
-27
lines changed Original file line number Diff line number Diff line change @@ -66,36 +66,37 @@ The query also includes a:
66
66
.. io-code-block::
67
67
:copyable: true
68
68
69
- .. input:: python
70
-
71
- client = pymongo.MongoClient('<connection-string>')
72
- result = client['sample_mflix']['movies'].aggregate([
73
- {
74
- "$search": {
75
- "phrase": {
76
- "path": "title",
77
- "query": "new york"
78
- }
79
- }
80
- },
81
- { $limit: 10 },
69
+ .. input::
70
+ :language: python
71
+
72
+ client = pymongo.MongoClient('<connection-string>')
73
+ result = client['sample_mflix']['movies'].aggregate([
82
74
{
83
- $project: {
84
- "_id": 0,
85
- "title": 1,
86
- score: { $meta: "searchScore" }
87
- }
75
+ "$search": {
76
+ "phrase": {
77
+ "path": "title",
78
+ "query": "new york"
79
+ }
80
+ }
81
+ },
82
+ { $limit: 10 },
83
+ {
84
+ $project: {
85
+ "_id": 0,
86
+ "title": 1,
87
+ score: { $meta: "searchScore" }
88
88
}
89
- ])
90
- for i in result:
91
- print(i)
89
+ }
90
+ ])
91
+
92
+ for i in result:
93
+ print(i)
92
94
93
- .. output::
94
- :language: shell
95
- :linenos:
96
- :visible: false
95
+ .. output::
96
+ :language: none
97
+ :visible: false
97
98
98
- [
99
+ [
99
100
{ title: 'New York, New York', score: 6.786321640014648 }
100
101
{ title: 'New York', score: 6.258549213409424 }
101
102
{ title: 'New York Stories', score: 5.3813982009887695 }
@@ -106,7 +107,7 @@ The query also includes a:
106
107
{ title: 'Escape from New York', score: 4.719893455505371 }
107
108
{ title: 'Naked in New York', score: 4.719893455505371 }
108
109
{ title: 'Autumn in New York', score: 4.719893455505371 }
109
- ]
110
+ ]
110
111
111
112
Next Steps
112
113
----------
You can’t perform that action at this time.
0 commit comments