I want to save users IP address to mongoDB using mongoose model file for user. Any has any suggestions how can I do that?
Users module file schema:
const userSchema = new Schema({
username: {
type: String,
required: true,
unique: true,
trim: true,
minlength: 4
},
password: {
type: String,
required: true,
trim: true,
minlength: 4
},
IP: {
type: String
}
}, { timestamps: true });