2
db.inventory.createIndex(
    {'category.name': 'text',
     'brand.name': 'text', 
     'name': 'text', 
     'store.name': 'text', 
     'collection_1' : 'text', 
     'sku' : 'text', 
     'parent_sku' : 'text' 
})

While Using This Commands getting error like "exception: namespace name generated from index name"

I'm using this because I M creating full Text Index in my application.. I have required many fields for Search index.. Then What should i have to do...????

1 Answer 1

1

You usually get this error when the auto generated index name is too long. The index name is generated by concatenating the different column names, however, the length is limited to 125 characters according to the documentation. You can resolve this error by manually specifying a shorter index name when creating the index:

db.inventory.createIndex({
  'category.name': 'text',
  'brand.name': 'text',
  'name': 'text',
  'store.name': 'text',
  'collection_1': 'text',
  'sku': 'text',
  'parent_sku': 'text'
 }, 
 {
    name: "myIndex1"
 }
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.