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.
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”).
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With