I'm having an issue right now with mongoose and node js.
first, here is my schema :
const clientSchema = new mongoose.Schema({
amountOfMoneyInEuro: {
type :Number,
required : true,
},
amountOfMoneyInGnf: {
type : Number,
required : true,
},
city: {
type : String,
enum: {
values: ['conakry', 'kindia', 'boke', 'collab'],
message: '{VALUE} is not supported',
},
required : true,
},
hours: {
type : String,
required : true,
},
moneyTypes: {
type : String,
required : true,
enum: {
values: ['liquide','orange Money'],
message: '{VALUE} is not supported',
}
},
clientName: {
type : String,
required : true,
minlength : 2
},
phoneNumber: {
type : String,
},
senderName: {
type : String,
required : true,
},
hasTakeMoney : {
type : Boolean,
default : false
},
date : {
type : Date,
immutable : true,
default: Date.now()
},
updatedDate : {
type : Date,
default : Date.now(),
},
fees : {
type : Number,
required : true
},
hasBeenModified : {
type : Boolean,
default : false
}
})
The problem is with date, indeed each time I create a new client the same hours is being returned by the function date.toLocateTimeString() and I don't know why.
Here is an example :
If I add client B 5 minutes afters Client A would have the same hours while there should be 5 minutes between their creation to the database.