feat: add text index for address field in permits collection

This commit is contained in:
2025-10-13 12:31:26 +05:30
parent 369adfaaa6
commit eedfc86a79

View File

@@ -105,7 +105,10 @@ const permitSchema = new mongoose.Schema({
taggedUsers: Array,
noc: String,
deed: String,
}).index({ tenantId: 1, permitNumber: 1 }, { unique: true });
});
permitSchema.index({ tenantId: 1, permitNumber: 1 }, { unique: true });
permitSchema.index({ "address.full_address": "text" });
export const permitFields = Object.keys(permitSchema.paths).filter(
(path) => path !== "__v"