Query#1: Let me know the how to create indexes on RecordID for following data sample that is stored in MongoDB.
{
"_id" : ObjectId("59b72aea36d62fd9e60f28f7"),
"EnrichedDocument" : {
"Common" : {
"Source" : {
"#text" : "DELL"
},
"Stage" : {
"#text" : "COMMON"
},
"RecordID" : {
"#text" : "1111111"
},
"Stage" : {
"#text" : "Order"
}
}
}
}
Query#2: After POC, we have narrowed to use following C# query to find duplicate records in a collection. Let me know if there is any better approach or index on the RecordID (refer query#1) will help to improve the performance.
returnDocument = collection.FindOneAndReplace(
document,
document,
new FindOneAndReplaceOptions<BsonDocument, BsonDocument> {
IsUpsert = true,
ReturnDocument = ReturnDocument.Before
}
);
Hi Preetham,
I would recommend to review MongoDB Indexes to get started in creating indexes.
See also MongoDB Query Optimization and Analyze Query Performance to see whether there are performance improvements that you could make.
Regards,
Wan