Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set index type 'text' using mongodb compass?

Tags:

I am currently using mongodb compass, I want to create index with type 'text'. I followed steps given on https://docs.mongodb.com/manual/indexes/#single-field. However, I failed to create index with type 'text'. In compass GUI, dropdown titled 'Select a type' does not show type 'text' in it's dropdown. Am I missing anything ?

Thanks, in advance.

like image 300
Kiran Avatar asked Sep 08 '18 11:09

Kiran


People also ask

How do you create a text index in MongoDB?

In MongoDB, we can create text indexes using db. collectionName. createIndex() method. So, to index a field that contains either string or an array of string elements, pass a document in the createIndex() method that contains the field and the string literal(i.e., “text”).

Is it possible to index text with MongoDB?

MongoDB provides text indexes to support text search queries on string content. Text indexes can include any field whose value is a string or an array of string elements. A collection can only have one text search index, but that index can cover multiple fields.

How do I change the field type in a MongoDB compass?

You can change the data type of a field by using the data type selectors on the right of the field in the Atlas Cloud Cluster as well as MongoDB Compass . If you want to update it using Mongo shell or any specific drivers of MongoDB then you can refer to the $convert operator.

What is index type in MongoDB?

MongoDB provides a text index type that supports searching for string content in a collection. These text indexes do not store language-specific stop words (e.g. "the", "a", "or") and stem the words in a collection to only store root words. See Text Indexes for more information on text indexes and search.


1 Answers

This is a bug. And you can also provide the feedback on https://feedback.mongodb.com/ to fix this issue. depending upon the voting and the people like to fix this issue, the issue will be fixed in the future versions.

like image 143
Techgeek Avatar answered Oct 13 '22 06:10

Techgeek