Download MongoDB Reference Manual

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Relational model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database model wikipedia , lookup

Clusterpoint wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Transcript
MongoDB Reference Manual, Release 2.4.14
text
Definition
text
New in version 2.4.
Searches text content stored in the text index. The text (page 167) command is case-insensitive.
The text (page 167) command returns all documents that contain any of the terms; i.e. it performs a logical
OR search. By default, the command limits the matches to the top 100 scoring documents, in descending score
order, but you can specify a different limit.
The text (page 167) command has the following syntax:
db.collection.runCommand( "text", { search: <string>,
filter: <document>,
project: <document>,
limit: <number>,
language: <string> } )
The text (page 167) command has the following parameters:
field string search A string of terms that MongoDB parses and uses to query the text index. Enclose the string of terms in escaped double quotes to match on the phrase. For further information
on the search field syntax, see The search Field (page 168).
field document filter Optional. A query document to further limit the results of the query using
another database field. Use any valid MongoDB query in the filter document, except if the index
includes an ascending or descending index field as a prefix. If the index includes an ascending
or descending index field as a prefix, the filter is required and the filter query must be
an equality match.
field document project Optional. Limits the fields returned by the query to only those specified. By
default, the _id field returns as part of the result set, unless you explicitly exclude the field in
the project document.
field number limit Optional. The maximum number of documents to include in the response. The
text (page 167) command sorts the results before applying the limit. The default limit is
100.
field string language Optional. The language that determines the list of stop words for the search
and the rules for the stemmer and tokenizer. If not specified, the search uses the default language
of the index. For supported languages, see Text Search Languages (page 171). Specify the
language in lowercase.
Returns The text (page 167) command returns a document that contains a field results that
contains an array of the highest scoring documents, in descending order by score. See Output
(page 170) for details.
Warning: The complete results of the text (page 167) command must fit within the BSON Document
Size (page 440). Otherwise, the command will limit the results to fit within the BSON Document Size
(page 440). Use the limit and the project parameters with the text (page 167) command to limit the
size of the result set.
Note:
2.2. Database Commands
167