Tài liệu về nhà → Hướng dẫn sử dụng MongoDB → MongoDB Manual
MongoDB cung cấp một giải pháp tìm kiếm toàn văn bản, tìm kiếm Atlas MongoDB, cho dữ liệu được lưu trữ trên Atlas MongoDB. Người dùng chạy triển khai MongoDB tự quản lý có quyền truy cập vào khả năng tìm kiếm văn bản tại chỗ.full-text search solution, MongoDB Atlas Search, for data hosted on MongoDB Atlas. Users running self-managed MongoDB deployments have access to on-premises text search capabilities.
Đối với người dùng MongoDB Atlas, tìm kiếm Atlas của MongoDB hỗ trợ lập chỉ mục văn bản chi tiết và ngôn ngữ truy vấn phong phú cho kết quả tìm kiếm nhanh, có liên quan. Để tìm hiểu thêm về các chỉ mục tìm kiếm toàn văn bản và truy vấn
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3, xem:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 queries, see:Atlas Các giai đoạn đường ống tổng hợp tìm kiếm
Xác định các chỉ mục tìm kiếm Atlas
Chạy các truy vấn tìm kiếm Atlas
Atlas Search cũng cung cấp các máy phân tích chung cho văn bản phân tích cú pháp cho tìm kiếm toàn văn, bao gồm hỗ trợ cho hơn 40 máy phân tích cụ thể ngôn ngữ. also offers common analyzers for parsing text for full-text search, including support for over 40 language-specific analyzers.
Đối với triển khai tại chỗ [không phải ATLAS], khả năng tìm kiếm văn bản của MongoDB hỗ trợ các hoạt động truy vấn thực hiện tìm kiếm văn bản của nội dung chuỗi. Để thực hiện tìm kiếm văn bản, MongoDB sử dụng chỉ mục văn bản và toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4.Ghi chú
Lượt xem không hỗ trợ tìm kiếm văn bản.
Để tìm hiểu thêm về tìm kiếm văn bản để triển khai tại chỗ, xem:
Chỉ mục văn bản
Toán tử tìm kiếm văn bản
MongoDB cũng hỗ trợ tìm kiếm văn bản cho các ngôn ngữ khác nhau. Xem ngôn ngữ tìm kiếm văn bản để biết danh sách các ngôn ngữ được hỗ trợ.
Sử dụng phương thức db.articles.createIndex[ { subject: "text" } ] "\"ssl certificate\" authority key" db.articles.createIndex[ { subject: "text" } ]
17 kết hợp với
48 để trả về các tài liệu phù hợp
19 hàng đầu. → MongoDB Manual
Các truy vấn sau đây tìm kiếm thuật ngữ
"\"ssl certificate\" authority key"
55 và sắp xếp kết quả theo điểm giảm dần, giới hạn kết quả đối với hai tài liệu phù hợp hàng đầu:full-text search solution, MongoDB Atlas Search, for data hosted on
MongoDB Atlas. Users running self-managed MongoDB deployments have access to on-premises text search capabilities.Các truy vấn sau đây tìm kiếm các tài liệu trong đó
db.articles.createIndex[ { subject: "text" } ]
21 bằng db.articles.createIndex[ { subject: "text" } ]
22 và trường được lập chỉ mục "\"ssl certificate\" authority key"
53 chứa các điều khoản "\"ssl certificate\" authority key"
55 hoặc "\"ssl certificate\" authority key"
62. Hoạt động cũng chỉ định thứ tự sắp xếp tăng dần db.articles.createIndex[ { subject: "text" } ]
26, sau đó giảm điểm tìm kiếm văn bản:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator for self-managed deployments.
4 performs a text search on the content of the fields indexed with a
text index. A db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 expression has the following syntax:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
{ $text: { $search: , $language: , $caseSensitive: , $diacriticSensitive: } }
MongoDB cung cấp một giải pháp tìm kiếm toàn văn bản, tìm kiếm Atlas MongoDB, cho dữ liệu được lưu trữ trên Atlas MongoDB. Người dùng chạy triển khai MongoDB tự quản lý có quyền truy cập vào khả năng tìm kiếm văn bản tại chỗ.
4 operator accepts a text query document with the
following fields:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
db.articles.insertMany[ [ |
{ _id: 1, subject: "coffee", author: "xyz", views: 50 }, |
{ _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, |
{ _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, |
{ _id: 4, subject: "baking", author: "xyz", views: 100 }, |
{ _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, |
{ _id: 6, subject: "Сырники", author: "jkl", views: 80 }, |
{ _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, |
{ _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } |
] ] |
4db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 Thực hiện tìm kiếm văn bản trên nội dung của các trường được lập chỉ mục với chỉ mục văn bản. Biểu thức db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 có cú pháp sau:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Toán tử
4 chấp nhận tài liệu truy vấn văn bản với các trường sau:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Đồng ruộng
Loại hìnhBehavior for more information on the field.
db.articles.find[ { $text: { $search: "coffee" } } ]
2
Đồng ruộng
Loại hình
Sự mô tả
db.articles.find[ { $text: { $search: "coffee" } } ]
4
boolean
sợi dây
Một chuỗi các thuật ngữ mà mongDB phân tích và sử dụng để truy vấn chỉ mục văn bản. MongoDB thực hiện tìm kiếm logic
db.articles.find[ { $text: { $search: "coffee" } } ]
1 về các thuật ngữ trừ khi được chỉ định là cụm từ. Xem hành vi để biết thêm thông tin trên lĩnh vực này.Case Insensitivity.
db.articles.find[ { $text: { $search: "coffee" } } ]
6
boolean
Không bắt buộc. Ngôn ngữ xác định danh sách các từ dừng cho tìm kiếm và các quy tắc cho stemmer và tokenizer. Nếu không được chỉ định, tìm kiếm sử dụng ngôn ngữ mặc định của chỉ mục. Đối với các ngôn ngữ được hỗ trợ, xem ngôn ngữ tìm kiếm văn bản.
Nếu bạn chỉ định giá trị ngôn ngữ là
db.articles.find[ { $text: { $search: "coffee" } } ]
3, thì tìm kiếm văn bản sử dụng mã thông báo đơn giản mà không có danh sách các từ dừng và không có nguồn gốc.Không bắt buộc. Một lá cờ Boolean để kích hoạt hoặc vô hiệu hóa tìm kiếm nhạy cảm trường hợp. Mặc định là
db.articles.find[ { $text: { $search: "coffee" } } ]
5; tức là tìm kiếm bảo vệ sự vô cảm của trường hợp của chỉ mục văn bản.Diacritic Insensitivity.
Để biết thêm thông tin, xem trường hợp vô cảm.
4 operator, by default, does not return results sorted in terms of the results' scores. For more information on sorting by the text search scores, see the Text Score
documentation.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Không bắt buộc. Một lá cờ Boolean để bật hoặc vô hiệu hóa tìm kiếm nhạy cảm với DiaCritic so với các chỉ mục văn bản phiên bản 3. Mặc định là
5; tức là các tìm kiếm bảo vệ sự không nhạy cảm của dấu hiệu của chỉ sốdb.articles.find[ { $text: { $search: "coffee" } } ]
8.db.articles.find[ { $text: { $search: "coffee" } } ]
4 expression.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ] Các tìm kiếm văn bản đối với các phiên bản trước của chỉ số
8 vốn đã nhạy cảm với dấu phụ và không thể điều chỉnh không nhạy cảm. Như vậy, tùy chọndb.articles.find[ { $text: { $search: "coffee" } } ]
6 không có tác dụng với các phiên bản trước của chỉ mụcdb.articles.find[ { $text: { $search: "coffee" } } ]
8.db.articles.find[ { $text: { $search: "coffee" } } ]
4 query can not appear indb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
5 expressions.{ _id: 1, subject: 'coffee', author: 'xyz', views: 50 }, { _id: 7, subject: 'coffee and cream', author: 'efg', views: 10 }, { _id: 2, subject: 'Coffee Shopping', author: 'efg', views: 5 } Để biết thêm thông tin, hãy xem sự vô cảm của Diacritic.
4 query can not appear indb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
7 query expressions or{ _id: 1, subject: 'coffee', author: 'xyz', views: 50 }, { _id: 7, subject: 'coffee and cream', author: 'efg', views: 10 }, { _id: 2, subject: 'Coffee Shopping', author: 'efg', views: 5 }
7 projection expressions.{ _id: 1, subject: 'coffee', author: 'xyz', views: 50 }, { _id: 7, subject: 'coffee and cream', author: 'efg', views: 10 }, { _id: 2, subject: 'Coffee Shopping', author: 'efg', views: 5 } Toán tử
4, theo mặc định, không trả về kết quả được sắp xếp theo điểm số của kết quả. Để biết thêm thông tin về việc sắp xếp theo điểm tìm kiếm văn bản, hãy xem tài liệu điểm văn bản.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 query in andb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
0 expression, all clauses in thedb.articles.find[ { $text: { $search: "bake coffee cake" } } ]
0 array must be indexed.db.articles.find[ { $text: { $search: "bake coffee cake" } } ]
Một truy vấn có thể chỉ định, nhiều nhất là một biểu thức
4.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 query expression.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ] Truy vấn
4 không thể xuất hiện trong các biểu thứcdb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
5.{ _id: 1, subject: 'coffee', author: 'xyz', views: 50 }, { _id: 7, subject: 'coffee and cream', author: 'efg', views: 10 }, { _id: 2, subject: 'Coffee Shopping', author: 'efg', views: 5 }
4 expression.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ] Truy vấn
4 không thể xuất hiện trong các biểu thức truy vấndb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
7 hoặc các biểu thức trình chiếu{ _id: 1, subject: 'coffee', author: 'xyz', views: 50 }, { _id: 7, subject: 'coffee and cream', author: 'efg', views: 10 }, { _id: 2, subject: 'Coffee Shopping', author: 'efg', views: 5 }
7.{ _id: 1, subject: 'coffee', author: 'xyz', views: 50 }, { _id: 7, subject: 'coffee and cream', author: 'efg', views: 10 }, { _id: 2, subject: 'Coffee Shopping', author: 'efg', views: 5 }
4 expression, which requires a special text index, with a query operator that requires a different type of special index. For example you cannot combinedb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 expression with thedb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
8 operator.db.articles.find[ { $text: { $search: "bake coffee cake" } } ]
Để sử dụng truy vấn
4 trong biểu thứcdb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
0, tất cả các mệnh đề trong mảngdb.articles.find[ { $text: { $search: "bake coffee cake" } } ]
0 phải được lập chỉ mục.db.articles.find[ { $text: { $search: "bake coffee cake" } } ]
Bạn không thể sử dụng
db.articles.find[ { $text: { $search: "bake coffee cake" } } ]
2 nếu truy vấn bao gồm biểu thức truy vấn db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator in aggregation, the following restrictions also apply.Bạn không thể chỉ định thứ tự sắp xếp
4 nếu truy vấn bao gồm biểu thứcdb.articles.find[ { $text: { $search: "bake coffee cake" } } ]
4.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 must be the first stage in the pipeline.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ] Bạn không thể kết hợp biểu thức
4, yêu cầu chỉ mục văn bản đặc biệt, với toán tử truy vấn yêu cầu một loại chỉ mục đặc biệt khác. Ví dụ: bạn không thể kết hợp biểu thứcdb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 với toán tửdb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
8.db.articles.find[ { $text: { $search: "bake coffee cake" } } ]
4 operator can only occur once in the stage.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ] Lượt xem không hỗ trợ tìm kiếm văn bản.
4 operator expression cannot appear indb.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
0 ordb.articles.find[ { $text: { $search: "bake coffee cake" } } ]
5 expressions.{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 } { "_id" : 7, "subject" : "coffee and cream", "author" : "efg", "views" : 10 } { "_id" : 1, "subject" : "coffee", "author" : "xyz", "views" : 50 } { "_id" : 3, "subject" : "Baking a cake", "author" : "abc", "views" : 90 } { "_id" : 4, "subject" : "baking", "author" : "xyz", "views" : 100 } Nếu sử dụng toán tử
4 trong tập hợp, các hạn chế sau cũng được áp dụng.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Trong trường
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3, chỉ định một chuỗi các từ mà toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 phân tích cú pháp và sử dụng để truy vấn chỉ mục văn bản.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator parses and uses to query the text index.Toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 xử lý hầu hết các dấu chấm câu trong chuỗi dưới dạng các trình phân cách, ngoại trừ một dấu gạch nối [db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1] phủ nhận thuật ngữ hoặc một trích dẫn kép thoát ra db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
2 chỉ định một cụm từ.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator treats most punctuation in
the string as delimiters, except a hyphen-minus [db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1] that negates term or an escaped double quotes db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
2 that specifies a phrase.Ghi chú
Trường
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 cho biểu thức db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 khác với giai đoạn tổng hợp tìm kiếm $ do Atlas Search cung cấp. Giai đoạn tổng hợp ____33 thực hiện tìm kiếm toàn văn trên các trường được chỉ định và chỉ có sẵn trên Atlas MongoDB.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 expression is different than the the
$search aggregation stage provided by Atlas Search. The db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 aggregation stage performs full-text search on specified fields and is only available on MongoDB Atlas.Để phù hợp với một cụm từ, trái ngược với các thuật ngữ cá nhân, gửi lại cụm từ trong trích dẫn kép thoát [
db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
2], như trong:Nếu chuỗi
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 bao gồm một cụm từ và các thuật ngữ riêng lẻ, tìm kiếm văn bản sẽ chỉ khớp với các tài liệu bao gồm cụm từ.Ví dụ: đã vượt qua chuỗi
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3:"\"ssl certificate\" authority key"
Toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 tìm kiếm cụm từ { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
0.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator searches for the phrase { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
0.Tiền tố một từ có dấu gạch nối [
db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1] phủ nhận một từ:Từ phủ định loại trừ các tài liệu chứa từ phủ định từ tập kết quả.
Khi được truyền một chuỗi tìm kiếm chỉ chứa các từ phủ định, tìm kiếm văn bản sẽ không khớp với bất kỳ tài liệu nào.
Một từ gạch nối, chẳng hạn như
2, không phải là một phủ định. Nếu được sử dụng trong một từ Hyphenated, toán tử{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
4 sẽ coi dấu gạch nối [db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
1] là một dấu phân cách. Để phủ nhận từdb.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
5 trong trường hợp này, bao gồm một khoảng cách giữa{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
6 và{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
7, tức là,{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
8.{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
4 operator treats the hyphen-minus [db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
1] as a delimiter. To negate the worddb.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
5 in this instance, include a space between{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
6 and{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
7, i.e.,{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
8.{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
Toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 thêm tất cả các phủ định vào truy vấn với toán tử logic "\"ssl certificate\" authority key"
00.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator adds all
negations to the query with the logical "\"ssl certificate\" authority key"
00 operator.Nhà điều hành
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 bỏ qua các từ dừng cụ thể về ngôn ngữ, chẳng hạn như "\"ssl certificate\" authority key"
02 và "\"ssl certificate\" authority key"
03 trong tiếng Anh.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator ignores language-specific stop words, such as "\"ssl certificate\" authority key"
02 and "\"ssl certificate\" authority key"
03 in English.Đối với trường hợp không nhạy cảm và điều chỉnh các tìm kiếm văn bản không nhạy cảm, toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 khớp với từ gốc hoàn chỉnh. Vì vậy, nếu một trường tài liệu chứa từ "\"ssl certificate\" authority key"
05, một tìm kiếm trên thuật ngữ "\"ssl certificate\" authority key"
06 sẽ không khớp. Tuy nhiên, "\"ssl certificate\" authority key"
05 hoặc "\"ssl certificate\" authority key"
08 sẽ phù hợp.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator matches on the complete stemmed word. So if a document field contains the word "\"ssl certificate\" authority key"
05, a search on the term "\"ssl certificate\" authority key"
06 will not match. However, "\"ssl certificate\" authority key"
05 or "\"ssl certificate\" authority key"
08 will match.Đối với tìm kiếm nhạy cảm trường hợp [nghĩa là
"\"ssl certificate\" authority key"
09], nếu gốc hậu tố chứa các chữ cái viết hoa, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 khớp với từ chính xác.case sensitive search [i.e. "\"ssl certificate\" authority key"
09], if the suffix stem contains uppercase letters, the db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator matches on the exact word.Đối với tìm kiếm nhạy cảm với diacritic [nghĩa là
"\"ssl certificate\" authority key"
11], nếu thân hậu tố chứa dấu hoặc dấu hiệu diarritic, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 khớp với từ chính xác.diacritic sensitive search [i.e. "\"ssl certificate\" authority key"
11], if the suffix stem contains the diacritic mark or marks, the db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator matches on the exact word.Toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 mặc định là sự vô cảm của trường hợp của chỉ mục văn bản:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator defaults to the case insensitivity of the text index:Chỉ số văn bản phiên bản 3 không nhạy cảm với các ký tự Latin có hoặc không có dấu hiệu và ký tự từ bảng chữ cái không phải là Latin, chẳng hạn như bảng chữ cái Cyrillic. Xem chỉ mục văn bản để biết chi tiết.
Các phiên bản trước của chỉ số
8 là trường hợp không nhạy cảm với các ký tự Latin mà không có dấu hiệu phụ; tức là chodb.articles.find[ { $text: { $search: "coffee" } } ]
15."\"ssl certificate\" authority key"
Để hỗ trợ tìm kiếm nhạy cảm trường hợp trong đó chỉ số
db.articles.find[ { $text: { $search: "coffee" } } ]
8 không nhạy cảm với trường hợp, chỉ định "\"ssl certificate\" authority key"
09.Khi thực hiện tìm kiếm nhạy cảm trường hợp [
"\"ssl certificate\" authority key"
09] trong đó chỉ số db.articles.find[ { $text: { $search: "coffee" } } ]
8 không nhạy cảm, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator:Đầu tiên tìm kiếm chỉ số
8 cho các trường hợp không nhạy cảm và phù hợp.db.articles.find[ { $text: { $search: "coffee" } } ]
Sau đó, để trả về chỉ các tài liệu phù hợp với trường hợp của các thuật ngữ tìm kiếm, thao tác truy vấn
4 bao gồm một giai đoạn bổ sung để lọc các tài liệu không khớp với trường hợp được chỉ định.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 query operation includes an additional stage to filter out the documents that do not match the specified case.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Đối với tìm kiếm nhạy cảm trường hợp [nghĩa là
"\"ssl certificate\" authority key"
09], nếu gốc hậu tố chứa các chữ cái viết hoa, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 khớp với từ chính xác.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator matches on the exact word.Đối với tìm kiếm nhạy cảm với diacritic [nghĩa là
"\"ssl certificate\" authority key"
11], nếu thân hậu tố chứa dấu hoặc dấu hiệu diarritic, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 khớp với từ chính xác.Toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 mặc định là sự vô cảm của trường hợp của chỉ mục văn bản:
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Chỉ số văn bản phiên bản 3 không nhạy cảm với các ký tự Latin có hoặc không có dấu hiệu và ký tự từ bảng chữ cái không phải là Latin, chẳng hạn như bảng chữ cái Cyrillic. Xem chỉ mục văn bản để biết chi tiết.
Các phiên bản trước của chỉ số
db.articles.find[ { $text: { $search: "coffee" } } ]
8 là trường hợp không nhạy cảm với các ký tự Latin mà không có dấu hiệu phụ; tức là cho "\"ssl certificate\" authority key"
15.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4
operator defaults to the diacritic insensitivity of the text index:Để hỗ trợ tìm kiếm nhạy cảm trường hợp trong đó chỉ số
8 không nhạy cảm với trường hợp, chỉ địnhdb.articles.find[ { $text: { $search: "coffee" } } ]
09."\"ssl certificate\" authority key"
Khi thực hiện tìm kiếm nhạy cảm trường hợp [
09] trong đó chỉ số"\"ssl certificate\" authority key"
8 không nhạy cảm, toán tửdb.articles.find[ { $text: { $search: "coffee" } } ]
4:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Đầu tiên tìm kiếm chỉ số
db.articles.find[ { $text: { $search: "coffee" } } ]
8 cho các trường hợp không nhạy cảm và phù hợp.Sau đó, để trả về chỉ các tài liệu phù hợp với trường hợp của các thuật ngữ tìm kiếm, thao tác truy vấn
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 bao gồm một giai đoạn bổ sung để lọc các tài liệu không khớp với trường hợp được chỉ định.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator has no effect with earlier versions of the db.articles.find[ { $text: { $search: "coffee" } } ]
8 index.Chỉ định
"\"ssl certificate\" authority key"
09 có thể ảnh hưởng đến hiệu suất.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator:Mẹo
Xem thêm:
4 query operation includes an additional stage to filter out the documents that do not match.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 mặc định là sự vô cảm của chỉ mục văn bản:Chỉ số văn bản phiên bản 3 là không nhạy cảm. Đó là, chỉ số không phân biệt giữa các ký tự có chứa các dấu hiệu điều hòa và đối tác không được đánh dấu của chúng, chẳng hạn như
"\"ssl certificate\" authority key"
27, "\"ssl certificate\" authority key"
28 và "\"ssl certificate\" authority key"
29.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator searches the db.articles.find[ { $text: { $search: "coffee" } } ]
8 index, which is diacritic sensitive.Đối với tìm kiếm nhạy cảm diarritic, nếu thân hậu tố chứa dấu hoặc dấu hiệu Diacritic, toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 khớp với từ chính xác.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator matches on the exact word.Mẹo
Xem thêm:
Toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 gán điểm cho mỗi tài liệu chứa thuật ngữ tìm kiếm trong các trường được lập chỉ mục. Điểm số đại diện cho sự liên quan của một tài liệu với một truy vấn tìm kiếm văn bản nhất định. Điểm số có thể là một phần của đặc tả phương pháp "\"ssl certificate\" authority key"
48 cũng như một phần của biểu thức chiếu. Biểu thức "\"ssl certificate\" authority key"
49 cung cấp thông tin về việc xử lý hoạt động db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4. Xem toán tử dự đoán { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 } { "_id" : 7, "subject" : "coffee and cream", "author" : "efg", "views" : 10 } { "_id" : 1, "subject" : "coffee", "author" : "xyz", "views" : 50 } { "_id" : 3, "subject" : "Baking a cake", "author" : "abc", "views" : 90 } { "_id" : 4, "subject" : "baking", "author" : "xyz", "views" : 100 }
6 để biết chi tiết về việc truy cập điểm để trình chiếu hoặc sắp xếp.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator assigns a score to each document that contains the
search term in the indexed fields. The score represents the relevance of a document to a given text search query. The score can be part of a "\"ssl certificate\" authority key"
48 method specification as well as part of the projection expression. The "\"ssl certificate\" authority key"
49 expression provides information on the processing of the
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operation. See { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 } { "_id" : 7, "subject" : "coffee and cream", "author" : "efg", "views" : 10 } { "_id" : 1, "subject" : "coffee", "author" : "xyz", "views" : 50 } { "_id" : 3, "subject" : "Baking a cake", "author" : "abc", "views" : 90 } { "_id" : 4, "subject" : "baking", "author" : "xyz", "views" : 100 }
6 projection operator for details on accessing the score for projection or sort.Các ví dụ sau đây giả định bộ sưu tập
"\"ssl certificate\" authority key"
52 có chỉ mục văn bản phiên bản 3 trên trường "\"ssl certificate\" authority key"
53:db.articles.createIndex[ { subject: "text" } ]
Tập hợp bộ sưu tập với các tài liệu sau:
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Truy vấn sau đây chỉ định chuỗi
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 của "\"ssl certificate\" authority key"
55:db.articles.find[ { $text: { $search: "coffee" } } ]
Truy vấn này trả về các tài liệu có chứa thuật ngữ
"\"ssl certificate\" authority key"
55 trong trường "\"ssl certificate\" authority key"
53 được lập chỉ mục, hay chính xác hơn là phiên bản gốc của từ:{ _id: 1, subject: 'coffee', author: 'xyz', views: 50 }, { _id: 7, subject: 'coffee and cream', author: 'efg', views: 10 }, { _id: 2, subject: 'Coffee Shopping', author: 'efg', views: 5 }
Mẹo
Xem thêm:
4 operator performs a logical db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
db.articles.find[ { $text: { $search: "coffee" } } ]
1 search on each term and returns documents that contains any of the terms.Toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 gán điểm cho mỗi tài liệu chứa thuật ngữ tìm kiếm trong các trường được lập chỉ mục. Điểm số đại diện cho sự liên quan của một tài liệu với một truy vấn tìm kiếm văn bản nhất định. Điểm số có thể là một phần của đặc tả phương pháp "\"ssl certificate\" authority key"
48 cũng như một phần của biểu thức chiếu. Biểu thức "\"ssl certificate\" authority key"
49 cung cấp thông tin về việc xử lý hoạt động db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4. Xem toán tử dự đoán { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 } { "_id" : 7, "subject" : "coffee and cream", "author" : "efg", "views" : 10 } { "_id" : 1, "subject" : "coffee", "author" : "xyz", "views" : 50 } { "_id" : 3, "subject" : "Baking a cake", "author" : "abc", "views" : 90 } { "_id" : 4, "subject" : "baking", "author" : "xyz", "views" : 100 }
6 để biết chi tiết về việc truy cập điểm để trình chiếu hoặc sắp xếp.db.articles.find[ { $text: { $search: "bake coffee cake" } } ]
Các ví dụ sau đây giả định bộ sưu tập
"\"ssl certificate\" authority key"
52 có chỉ mục văn bản phiên bản 3 trên trường "\"ssl certificate\" authority key"
53:or "\"ssl certificate\" authority key"
55 or "\"ssl certificate\" authority key"
64 in the indexed "\"ssl certificate\" authority key"
53 field, or more precisely, the stemmed version of these words:{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 } { "_id" : 7, "subject" : "coffee and cream", "author" : "efg", "views" : 10 } { "_id" : 1, "subject" : "coffee", "author" : "xyz", "views" : 50 } { "_id" : 3, "subject" : "Baking a cake", "author" : "abc", "views" : 90 } { "_id" : 4, "subject" : "baking", "author" : "xyz", "views" : 100 }
Mẹo
Tập hợp bộ sưu tập với các tài liệu sau:
Truy vấn sau đây chỉ định chuỗi
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 của "\"ssl certificate\" authority key"
55:db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
Truy vấn này trả về các tài liệu có chứa thuật ngữ
"\"ssl certificate\" authority key"
55 trong trường "\"ssl certificate\" authority key"
53 được lập chỉ mục, hay chính xác hơn là phiên bản gốc của từ:Nếu chuỗi tìm kiếm là một chuỗi được chọn lọc không gian, thì toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ thực hiện tìm kiếm logic db.articles.find[ { $text: { $search: "coffee" } } ]
1 trên mỗi thuật ngữ và trả về các tài liệu chứa bất kỳ điều khoản nào.Mẹo
Xem thêm:
Toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 gán điểm cho mỗi tài liệu chứa thuật ngữ tìm kiếm trong các trường được lập chỉ mục. Điểm số đại diện cho sự liên quan của một tài liệu với một truy vấn tìm kiếm văn bản nhất định. Điểm số có thể là một phần của đặc tả phương pháp "\"ssl certificate\" authority key"
48 cũng như một phần của biểu thức chiếu. Biểu thức "\"ssl certificate\" authority key"
49 cung cấp thông tin về việc xử lý hoạt động db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4. Xem toán tử dự đoán { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 } { "_id" : 7, "subject" : "coffee and cream", "author" : "efg", "views" : 10 } { "_id" : 1, "subject" : "coffee", "author" : "xyz", "views" : 50 } { "_id" : 3, "subject" : "Baking a cake", "author" : "abc", "views" : 90 } { "_id" : 4, "subject" : "baking", "author" : "xyz", "views" : 100 }
6 để biết chi tiết về việc truy cập điểm để trình chiếu hoặc sắp xếp.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator will exclude the documents that contain those terms from the results.Các ví dụ sau đây giả định bộ sưu tập
"\"ssl certificate\" authority key"
52 có chỉ mục văn bản phiên bản 3 trên trường "\"ssl certificate\" authority key"
53:not contain the term "\"ssl certificate\" authority key"
71, or more precisely the stemmed version of the words:"\"ssl certificate\" authority key"
0Tập hợp bộ sưu tập với các tài liệu sau:
"\"ssl certificate\" authority key"
1Mẹo
Truy vấn sau đây chỉ định chuỗi
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 của "\"ssl certificate\" authority key"
55:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 expression to specify a language that
determines the list of stop words and the rules for the stemmer and tokenizer for the search string.Truy vấn này trả về các tài liệu có chứa thuật ngữ
"\"ssl certificate\" authority key"
55 trong trường "\"ssl certificate\" authority key"
53 được lập chỉ mục, hay chính xác hơn là phiên bản gốc của từ:Nếu chuỗi tìm kiếm là một chuỗi được chọn lọc không gian, thì toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ thực hiện tìm kiếm logic db.articles.find[ { $text: { $search: "coffee" } } ]
1 trên mỗi thuật ngữ và trả về các tài liệu chứa bất kỳ điều khoản nào."\"ssl certificate\" authority key"
2Tập hợp bộ sưu tập với các tài liệu sau:
"\"ssl certificate\" authority key"
3Truy vấn sau đây chỉ định chuỗi
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 của "\"ssl certificate\" authority key"
55:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 expression can also accept the language by name, "\"ssl certificate\" authority key"
77. See Text Search Languages for the supported languages.Mẹo
Xem thêm:
Truy vấn này trả về các tài liệu có chứa thuật ngữ
"\"ssl certificate\" authority key"
55 trong trường "\"ssl certificate\" authority key"
53 được lập chỉ mục, hay chính xác hơn là phiên bản gốc của từ:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator defers to the case and diacritic insensitivity of the db.articles.find[ { $text: { $search: "coffee" } } ]
8 index. The version 3 db.articles.find[ { $text: { $search: "coffee" } } ]
8 index is diacritic insensitive and expands its case insensitivity to include the Cyrillic alphabet as well as characters with diacritics. For details, see
text Index Case Insensitivity and text Index Diacritic Insensitivity.Nếu chuỗi tìm kiếm là một chuỗi được chọn lọc không gian, thì toán tử
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ thực hiện tìm kiếm logic db.articles.find[ { $text: { $search: "coffee" } } ]
1 trên mỗi thuật ngữ và trả về các tài liệu chứa bất kỳ điều khoản nào."\"ssl certificate\" authority key"
4Truy vấn sau đây chỉ định chuỗi
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
3 gồm ba thuật ngữ được phân định theo không gian, "\"ssl certificate\" authority key"
61:"\"ssl certificate\" authority key"
5Truy vấn này trả về các tài liệu có chứa
"\"ssl certificate\" authority key"
62 hoặc "\"ssl certificate\" authority key"
55 hoặc "\"ssl certificate\" authority key"
64 trong trường "\"ssl certificate\" authority key"
53 được lập chỉ mục, hay chính xác hơn là phiên bản gốc của các từ này:Mẹo
Để phù hợp với cụm từ chính xác như một thuật ngữ duy nhất, hãy thoát các trích dẫn.
Các truy vấn sau đây tìm kiếm cụm từ
"\"ssl certificate\" authority key"
66:"\"ssl certificate\" authority key"
6Truy vấn này trả về các tài liệu chứa cụm từ
"\"ssl certificate\" authority key"
66:"\"ssl certificate\" authority key"
7Mẹo
{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
"\"ssl certificate\" authority key"
8Truy vấn này trả về các tài liệu chứa cụm từ
"\"ssl certificate\" authority key"
66:"\"ssl certificate\" authority key"
9Mẹo
{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 operator will exclude the documents that contain those terms from the results. You can also specify case sensitivity for negated terms.Một thuật ngữ phủ định là một thuật ngữ được đặt trước một dấu hiệu trừ
db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1. Nếu bạn phủ nhận một thuật ngữ, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ loại trừ các tài liệu có chứa các thuật ngữ đó khỏi kết quả.not contain the lower-case term "\"ssl certificate\" authority key"
71, or more precisely the stemmed version of the
words:db.articles.createIndex[ { subject: "text" } ]
0Ví dụ sau đây tìm kiếm các tài liệu chứa các từ
"\"ssl certificate\" authority key"
55 nhưng không chứa thuật ngữ "\"ssl certificate\" authority key"
71 hoặc chính xác hơn là phiên bản gốc của các từ:db.articles.createIndex[ { subject: "text" } ]
1Mẹo
Truy vấn trả về các tài liệu sau:
Truy vấn sau đây thực hiện tìm kiếm văn bản nhạy cảm diarritic trên thuật ngữ
"\"ssl certificate\" authority key"
95, hay chính xác hơn là phiên bản gốc của từ:db.articles.createIndex[ { subject: "text" } ]
2Truy vấn chỉ khớp với tài liệu sau:
db.articles.createIndex[ { subject: "text" } ]
3Mẹo
Tùy chọn
db.articles.find[ { $text: { $search: "coffee" } } ]
6 cũng áp dụng cho các thuật ngữ phủ định. Một thuật ngữ phủ định là một thuật ngữ được đặt trước một dấu hiệu trừ db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1. Nếu bạn phủ nhận một thuật ngữ, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ loại trừ các tài liệu có chứa các thuật ngữ đó khỏi kết quả.db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4
operator will exclude the documents that contain those terms from the results.Truy vấn sau đây thực hiện tìm kiếm văn bản nhạy cảm nhảm nhí cho tài liệu chứa thuật ngữ
"\"ssl certificate\" authority key"
99 nhưng không phải là thuật ngữ db.articles.createIndex[ { subject: "text" } ]
00, hay chính xác hơn là phiên bản gốc của các từ:db.articles.createIndex[ { subject: "text" } ]
4Truy vấn khớp với tài liệu sau:
db.articles.createIndex[ { subject: "text" } ]
5Mẹo
Tùy chọn
db.articles.find[ { $text: { $search: "coffee" } } ]
6 cũng áp dụng cho các thuật ngữ phủ định. Một thuật ngữ phủ định là một thuật ngữ được đặt trước một dấu hiệu trừ db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1. Nếu bạn phủ nhận một thuật ngữ, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ loại trừ các tài liệu có chứa các thuật ngữ đó khỏi kết quả.db.articles.createIndex[ { subject: "text" } ]
6Truy vấn sau đây thực hiện tìm kiếm văn bản nhạy cảm nhảm nhí cho tài liệu chứa thuật ngữ
"\"ssl certificate\" authority key"
99 nhưng không phải là thuật ngữ db.articles.createIndex[ { subject: "text" } ]
00, hay chính xác hơn là phiên bản gốc của các từ:db.articles.createIndex[ { subject: "text" } ]
7Mẹo
Tùy chọn db.articles.find[ { $text: { $search: "coffee" } } ]
6 cũng áp dụng cho các thuật ngữ phủ định. Một thuật ngữ phủ định là một thuật ngữ được đặt trước một dấu hiệu trừ db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1. Nếu bạn phủ nhận một thuật ngữ, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ loại trừ các tài liệu có chứa các thuật ngữ đó khỏi kết quả.
db.articles.find[ { $text: { $search: "coffee" } } ]
db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Truy vấn sau đây thực hiện tìm kiếm văn bản nhạy cảm nhảm nhí cho tài liệu chứa thuật ngữ
99 nhưng không phải là thuật ngữ"\"ssl certificate\" authority key"
00, hay chính xác hơn là phiên bản gốc của các từ:db.articles.createIndex[ { subject: "text" } ]
8db.articles.createIndex[ { subject: "text" } ]
Truy vấn khớp với tài liệu sau:
Truy vấn sau thực hiện tìm kiếm văn bản cho thuật ngữ
64 và sử dụng toán tử"\"ssl certificate\" authority key"
6 trong tài liệu chiếu để nối điểm số liên quan đến mỗi tài liệu phù hợp:{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 } { "_id" : 7, "subject" : "coffee and cream", "author" : "efg", "views" : 10 } { "_id" : 1, "subject" : "coffee", "author" : "xyz", "views" : 50 } { "_id" : 3, "subject" : "Baking a cake", "author" : "abc", "views" : 90 } { "_id" : 4, "subject" : "baking", "author" : "xyz", "views" : 100 } Tài liệu được trả lại bao gồm một trường bổ sung
03 chứa điểm số liên quan của tài liệu:db.articles.createIndex[ { subject: "text" } ]
Xem thêm:
9db.articles.createIndex[ { subject: "text" } ]
Bắt đầu từ MongoDB 4.4, bạn có thể chỉ định biểu thức
49 trong"\"ssl certificate\" authority key"
48 mà không chỉ định biểu thức trong phép chiếu. Ví dụ,"\"ssl certificate\" authority key"
Do đó, bạn có thể sắp xếp các tài liệu kết quả theo mức độ liên quan tìm kiếm của họ mà không cần chiếu
06.samedb.articles.createIndex[ { subject: "text" } ]
6 expression in both the projection document and the sort expression. The following query searches for the term{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 } { "_id" : 7, "subject" : "coffee and cream", "author" : "efg", "views" : 10 } { "_id" : 1, "subject" : "coffee", "author" : "xyz", "views" : 50 } { "_id" : 3, "subject" : "Baking a cake", "author" : "abc", "views" : 90 } { "_id" : 4, "subject" : "baking", "author" : "xyz", "views" : 100 }
55 and sorts the results by the descending score:"\"ssl certificate\" authority key"
0db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ] Trong các phiên bản trước, bao gồm biểu thức
49 trong"\"ssl certificate\" authority key"
48, bạn cũng phải bao gồm cùng một biểu thức trong phép chiếu."\"ssl certificate\" authority key"
Mẹo
Tùy chọn db.articles.find[ { $text: { $search: "coffee" } } ]
6 cũng áp dụng cho các thuật ngữ phủ định. Một thuật ngữ phủ định là một thuật ngữ được đặt trước một dấu hiệu trừ db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1. Nếu bạn phủ nhận một thuật ngữ, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ loại trừ các tài liệu có chứa các thuật ngữ đó khỏi kết quả.
db.articles.find[ { $text: { $search: "coffee" } } ]
db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Truy vấn sau đây thực hiện tìm kiếm văn bản nhạy cảm nhảm nhí cho tài liệu chứa thuật ngữ
"\"ssl certificate\" authority key"
99 nhưng không phải là thuật ngữ db.articles.createIndex[ { subject: "text" } ]
00, hay chính xác hơn là phiên bản gốc của các từ:Truy vấn khớp với tài liệu sau:
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
1Mẹo
Tùy chọn db.articles.find[ { $text: { $search: "coffee" } } ]
6 cũng áp dụng cho các thuật ngữ phủ định. Một thuật ngữ phủ định là một thuật ngữ được đặt trước một dấu hiệu trừ db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1. Nếu bạn phủ nhận một thuật ngữ, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ loại trừ các tài liệu có chứa các thuật ngữ đó khỏi kết quả.
db.articles.find[ { $text: { $search: "coffee" } } ]
db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
Truy vấn sau đây thực hiện tìm kiếm văn bản nhạy cảm nhảm nhí cho tài liệu chứa thuật ngữ
"\"ssl certificate\" authority key"
99 nhưng không phải là thuật ngữ db.articles.createIndex[ { subject: "text" } ]
00, hay chính xác hơn là phiên bản gốc của các từ:db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
2Mẹo
Tùy chọn db.articles.find[ { $text: { $search: "coffee" } } ]
6 cũng áp dụng cho các thuật ngữ phủ định. Một thuật ngữ phủ định là một thuật ngữ được đặt trước một dấu hiệu trừ db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
1. Nếu bạn phủ nhận một thuật ngữ, toán tử db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]
4 sẽ loại trừ các tài liệu có chứa các thuật ngữ đó khỏi kết quả.
db.articles.find[ { $text: { $search: "coffee" } } ]
db.articles.find[ { $text: { $search: "\"coffee shop\"" } } ]
db.articles.insertMany[ [ { _id: 1, subject: "coffee", author: "xyz", views: 50 }, { _id: 2, subject: "Coffee Shopping", author: "efg", views: 5 }, { _id: 3, subject: "Baking a cake", author: "abc", views: 90 }, { _id: 4, subject: "baking", author: "xyz", views: 100 }, { _id: 5, subject: "Café Con Leche", author: "abc", views: 200 }, { _id: 6, subject: "Сырники", author: "jkl", views: 80 }, { _id: 7, subject: "coffee and cream", author: "efg", views: 10 }, { _id: 8, subject: "Cafe con Leche", author: "xyz", views: 10 } ] ]