Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Specify concrete field in $text search

Hi, I didn’t find an answer anywhere on the web, respectively, I found answers that it doesn’t work, or that it only works through ElestacSearch. However, since I’m just getting started with MongoDB, I thought I’d ask here too.
So: let’s say we have something like a dictionary, ie the field “eng” and the field “cze”, it looks something like this:
Code: [Select]

{’’ eng ‘:’ some text ‘,’ cze ‘:’ some other text '}

and those lines are, of course, lots.
According to the MongoDB manual, I can’t create more $ text indexes, but I can create an index that covers more fields (in my case “eng” and “cze”), like this:
Code: [Select]

create_index ([(‘eng’, ‘text’), (‘cze’, ‘text’)])

But then I can’t search only and only in the field “eng” or only and only in the field “cze”, I just search in the whole $ text of the index, like this:
Code: [Select]

find ({" text": {" search": “something”}})

If I run the $ text index only on the “eng” field or only on the “cze” field, then the results are really good sorted, I don’t even have to use any special metascore sorting, it’s just automatically aligned according to the best match and it works really well . But I would like it to work this way for both the “eng” and “cze” fields, ie to search only for Czech once and only for English once (not all at once).
All I thought about would be to make two identical databases and index one field in each, but that would come to me.
I’m really starting with MongoDB, so I apologize if the question is somehow out, but I’d really like some advice. Thanks for every relevant answer.

Jiří