HyuOniichan / Prj_WanderingWords

A blog website using MERN stack
0 stars 0 forks source link

[bug] timestamps error #6

Open HyuOniichan opened 1 day ago

HyuOniichan commented 1 day ago

Problem Can't access to createdAt (automatically added when using timestamps: true in mongoose)

Reproduce backend > models > blogModel.js image timestamps: true

frontend > src > components > blogComponents > BlogList.js image fetch data

console window image

api: http://localhost:8000/v1/blog image No sign of createdAt or updatedAt field

Expected Can access to createdAt field to make 'published date' for blog

HyuOniichan commented 1 day ago

Reason The data in MongoDB is manually created through Atlas, and the timestamps is not auto generated, it is created through mongoose instead.

Fixed Insert later in future