specializations: [specializationsSchema],
const specializationsSchema = new mongoose.Schema({
specialityId: {
type: String,
required: true,
},
specialityName: {
type: String,
required: true,
},
status: {
type: String,
enum: ['active', 'inactive'],
default: 'active'
}
})
here ‘specialityName’ field is added later but not able to add the search index for this
Aasawari
(Aasawari Sahasrabuddhe)
May 1, 2023, 7:32am
#3
Hi @curaster_app and welcome to MongoDB community forums!!
Based on my understanding from the above posts, I tried to replicate the issue in my test Atlas cluster with version 6.0.5 using the following steps:
Create a new document as:
{
_id: ObjectId("644f59e524564d038dd192d7"),
specialityId: '12334567',
status: [ 'active', 'inactive' ]
}
Add the new field to the above collection using:
db.searchAtlas.updateOne(
{ specialityId: '12334567'},
{ $set: { "specialityName": "ABC"}})
Create search index on the specialityName fields
{
"analyzer": "lucene.whitespace",
"searchAnalyzer": "lucene.whitespace",
"mappings": {
"dynamic": false,
"fields": {
"specialityName": {
"type": "document"
}
}
}
}
I was successfully able to create the search index for the fields. Therefore to understand your concern better, could you help me with the few details below.
Steps to reproduce the issue if it different from the above steps posted.
Search index definition.
Error message been observed.
Regards
Aasawari
1 Like