Reputation: 162
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...????
Upvotes: 2
Views: 624
Reputation: 21766
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"
}
)
Upvotes: 1