Skip to content

Commit 3f5dafb

Browse files
committed
fix code
1 parent 91e0cb8 commit 3f5dafb

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

source/atlas-search.txt

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -66,36 +66,37 @@ The query also includes a:
6666
.. io-code-block::
6767
:copyable: true
6868

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([
8274
{
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" }
8888
}
89-
])
90-
for i in result:
91-
print(i)
89+
}
90+
])
91+
92+
for i in result:
93+
print(i)
9294

93-
.. output::
94-
:language: shell
95-
:linenos:
96-
:visible: false
95+
.. output::
96+
:language: none
97+
:visible: false
9798

98-
[
99+
[
99100
{ title: 'New York, New York', score: 6.786321640014648 }
100101
{ title: 'New York', score: 6.258549213409424 }
101102
{ title: 'New York Stories', score: 5.3813982009887695 }
@@ -106,7 +107,7 @@ The query also includes a:
106107
{ title: 'Escape from New York', score: 4.719893455505371 }
107108
{ title: 'Naked in New York', score: 4.719893455505371 }
108109
{ title: 'Autumn in New York', score: 4.719893455505371 }
109-
]
110+
]
110111

111112
Next Steps
112113
----------

0 commit comments

Comments
 (0)