R
Railway11mo ago
jit

Mongo error: Date set by default in railway server is same within a time frame

My tech stack is Nest JS, Mongo and react. So, In railway I have a schema for a collection in mongo in which there is a field named "dateAdded". Now suppose I created two documents in that same collection. Then both of them have the same time added. And this is only encountered when using railway. How to debug it or correct this behaviour ?? [ { "_id": { "$oid": "654e548514691df1f4dacd73" }, "dateAdded": "2023-11-10T16:04:01.696Z", }, { "_id": { "$oid": "654e54b414691df1f4dacd7b" }, "dateAdded": "2023-11-10T16:04:01.696Z", }, { "_id": { "$oid": "654e54b51480c9fc09a24ded" }, "dateAdded": "2023-11-08T21:42:30.342Z", } ] This is a stripped down example of the collection. where the first two documents were created within a 1-minute time frame. But have the same string. Right down to the last millisecond.
7 Replies
Percy
Percy11mo ago
Project ID: N/A
Brody
Brody11mo ago
what are you using to add data to the collection?
jit
jit11mo ago
this is my collection schema @Prop({ type: String, required: true, default: new Date().toISOString(), }) dateAdded: string; and this is how the create functionality is implemented const createConversation: CreateConversationDto = { conversationType: 'GhlConversation', body: message, messageType: payload.messageType, resourceId: payload.locationId, direction: direction, channelDetails: { contactId: payload.contactId, } } const newConversation = new this.conversationModel(createConversation); return await newConversation.save();
Brody
Brody11mo ago
is the client you are using compatible with the mongo version railway is running? because there's absolutely nothing special about the mongo database you deployed, this wouldn't be an issue with railway
jit
jit11mo ago
WHat do you mean by client? The nest js app ? And how do I check whether it is compatible or not ?
Brody
Brody11mo ago
have a look at client libraries documentation please
jit
jit11mo ago
okay thanks a lot. Let me check it
Want results from more Discord servers?
Add your server