Hướng dẫn how does mongodb search? - mongodb tìm kiếm như thế nào?

Tài liệu về nhà → Hướng dẫn sử dụng MongoDBMongoDB Manual

Show

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" } )

17 kết hợp với

"\"ssl certificate\" authority key"

48 để trả về các tài liệu phù hợp

db.articles.createIndex( { subject: "text" } )

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.

Tài liệu về nhà → Hướng dẫn sử dụng 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 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:

{
$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ỗ.

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 accepts a text query document with the following fields:

Trang này mô tả 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 để triển khai tự quản lý.

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 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:

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 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 }
] )
3

Đồ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.

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, 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.

  • 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à

    db.articles.find( { $text: { $search: "coffee" } } )

    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.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.

  • 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ố

    db.articles.find( { $text: { $search: "coffee" } } )

    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ọn

    db.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ục

    db.articles.find( { $text: { $search: "coffee" } } )

    8.
    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 can not appear in
    { _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 }
    5 expressions.

  • Để biết thêm thông tin, hãy xem sự vô cảm của Diacritic.

    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 can not appear in
    { _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 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.

  • 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, 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 an

    db.articles.find( { $text: { $search: "bake coffee cake" } } )

    0 expression, all clauses in the

    db.articles.find( { $text: { $search: "bake coffee cake" } } )

    0 array must be indexed.

  • Một truy vấn có thể chỉ định, nhiều nhất là một 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.
    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.

  • 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 không thể xuất hiện trong các biểu thức
    { _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 }
    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
    expression.

  • 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 không thể xuất hiện trong các biểu thức truy vấn
    { _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 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.
    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, which requires a special text index, with a query operator that requires a different type of special index. For example you cannot combine
    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 with the

    db.articles.find( { $text: { $search: "bake coffee cake" } } )

    8 operator.

  • Để sử dụng 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 trong biểu thức

    db.articles.find( { $text: { $search: "bake coffee cake" } } )

    0, tất cả các mệnh đề trong mảng

    db.articles.find( { $text: { $search: "bake coffee cake" } } )

    0 phải được lập chỉ mục.

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

    db.articles.find( { $text: { $search: "bake coffee cake" } } )

    4 nếu truy vấn bao gồm 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.
    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.

  • Bạn không thể kết hợp 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, 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ứ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 với toán tử

    db.articles.find( { $text: { $search: "bake coffee cake" } } )

    8.
    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 can only occur once in the stage.

  • Lượt xem không hỗ trợ 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 expression cannot appear in

    db.articles.find( { $text: { $search: "bake coffee cake" } } )

    0 or
    { "_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 }
    5 expressions.

  • Nếu sử dụ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 trong tập hợp, các hạn chế sau cũng được áp dụng.

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ư

    { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }

    2, không phải là một phủ định. Nếu được sử dụng trong một từ Hyphenated, 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ẽ coi dấu gạch nối (

    db.articles.find( { $text: { $search: "\"coffee shop\"" } } )

    1) là một dấu phân cách. Để phủ nhận từ

    { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }

    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.
    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 the hyphen-minus (

    db.articles.find( { $text: { $search: "\"coffee shop\"" } } )

    1) as a delimiter. To negate the word

    { "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }

    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.

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ố

    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.

Để 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ố

    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
    query operation includes an additional stage to filter out the documents that do not match the specified case.

Đố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:

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ố

    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:

Đầ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:

    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.

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:

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 performs a logical

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"

0

Tập hợp bộ sưu tập với các tài liệu sau:

"\"ssl certificate\" authority key"

1

Mẹ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"

2

Tập hợp bộ sưu tập với các tài liệu sau:

"\"ssl certificate\" authority key"

3

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 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"

4

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 gồm ba thuật ngữ được phân định theo không gian,

"\"ssl certificate\" authority key"

61:

"\"ssl certificate\" authority key"

5

Truy 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"

6

Truy 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"

7

Mẹo

{ "_id" : 2, "subject" : "Coffee Shopping", "author" : "efg", "views" : 5 }

"\"ssl certificate\" authority key"

8

Truy 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"

9

Mẹ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" } )

0

Ví 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" } )

1

Mẹ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" } )

2

Truy vấn chỉ khớp với tài liệu sau:

db.articles.createIndex( { subject: "text" } )

3

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.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" } )

4

Truy vấn khớp với tài liệu sau:

db.articles.createIndex( { subject: "text" } )

5

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.createIndex( { subject: "text" } )

6

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" } )

7

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ả.

  • 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" } )

    8

    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ữ

    "\"ssl certificate\" authority key"

    64 và sử dụng toán tử
    { "_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 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:

  • Tài liệu được trả lại bao gồm một trường bổ sung

    db.articles.createIndex( { subject: "text" } )

    03 chứa điểm số liên quan của tài liệu:

    Xem thêm:

    db.articles.createIndex( { subject: "text" } )

    9

    Bắt đầu từ MongoDB 4.4, bạn có thể chỉ định biểu thức

    "\"ssl certificate\" authority key"

    49 trong

    "\"ssl certificate\" authority key"

    48 mà không chỉ định biểu thức trong phép chiếu. Ví dụ,

  • 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

    db.articles.createIndex( { subject: "text" } )

    06.same
    { "_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 expression in both the projection document and the sort expression. The following query searches for the term

    "\"ssl certificate\" authority key"

    55 and sorts the results by the descending score:

    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 }
    ] )
    0

    Trong các phiên bản trước, bao gồm biểu thức

    "\"ssl certificate\" authority key"

    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.

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ả.

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 }
] )
1

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ả.

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 }
] )
2

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ả.