37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
const mongoose = require("mongoose");
|
|
|
|
const peopleInfoSchema = new mongoose.Schema(
|
|
{
|
|
mobile: { type: String, required: false, index: true },
|
|
name: { type: String, required: false, index: true },
|
|
family: { type: String, required: false, index: true },
|
|
birthdate: { type: String, required: false },
|
|
nationalcode: { type: String, required: false, index: true },
|
|
mellicard: { type: String, required: false },
|
|
info1: { type: String, required: false },
|
|
info2: { type: String, required: false },
|
|
info3: { type: String, required: false },
|
|
info4: { type: String, required: false },
|
|
},
|
|
{ timestamps: false }
|
|
);
|
|
|
|
peopleInfoSchema.index({ nationalcode: 1 });
|
|
peopleInfoSchema.index({ mobile: 1 });
|
|
peopleInfoSchema.index({ name: 1, family: 1 });
|
|
|
|
peopleInfoSchema.index(
|
|
{ name: "text", family: "text" },
|
|
{
|
|
default_language: "none",
|
|
weights: { name: 10, family: 10 },
|
|
}
|
|
);
|
|
|
|
peopleInfoSchema.index({ name: 1 });
|
|
peopleInfoSchema.index({ family: 1 });
|
|
|
|
const PeopleInfo = mongoose.model("PeopleInfo", peopleInfoSchema);
|
|
|
|
module.exports = PeopleInfo;
|