F
F
freestm2017-10-02 18:02:40
MongoDB
freestm, 2017-10-02 18:02:40

How to do text query search for mongodb?

You need to search for items by title. That is, if some word from the request is in the title of the product, then return this document. The client is angular, the server is node.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
RidgeA, 2017-10-02
@RidgeA

regular search?
https://docs.mongodb.com/manual/reference/operator...

L
lega, 2017-10-02
@lega

In monge there is a full-text search, regular expressions are only for small collections because they sort through the entire collection without indexes.

A
Abcdefgk, 2017-10-02
@Abcdefgk

The field in the collection to search for must be indexed in the database as "text", and then requested with the operators .find( { $text: { $search: "bla-bla" } } )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question