skip to content
Alvin Lucillo

Exact match text query

/ 1 min read

In October 5 journal, we saw a simple text query. That kind of search, however, is broken down into tokens with unintended results. For example, a simple query below will be tokenized into ["1", "0"]. This will result to multiple results that you might not expect if you’re expecting it to match 1.0.

{ "$text": { "$search": "1.0" } }

If you want an exact match, enclose the query with double quotes.

{ "$text": { "$search": "\"1.0\"" } }