Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/693792c0-531c-8002-882d-32b6d8c762ad
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: เออ กูเห็นจากรูปละ ประเด็นที่มันเถียงกันคือเรื่องพวก: === เออ กูเห็นจากรูปละ ประเด็นที่มันเถียงกันคือเรื่องพวก: * CreatedAt * UpdatedAt * Timestamp * แล้วมีคนบอกว่า “ใช้ไม่เหมือนกันตั้งแต่ collection” * เจ้าของโพสต์ตอบว่า “มันแสดงผลเหมือน table join” สรุปสั้นๆ แบบไม่โลกสวย: ==== สองชื่อนี้ ไม่ใช่ keyword กลางของทุก DB ==== มันคือ “convention” ที่ framework นิยมตั้งกันเอง เช่น: * Sequelize / TypeORM (SQL) * Mongoose (MongoDB) * ORM ฝั่ง Laravel / Django บางที่ใช้: * created_at, updated_at * บางที่ใช้ CreatedAt, UpdatedAt * บางระบบไม่ auto สร้างให้เลย ต้องเขียนเอง เพราะงั้นที่อีกคนบอกว่า : ==== Timestamp มักหมายถึง: ==== * epoch เช่น 1700000000 * หรือ milliseconds เอาไว้: * เปรียบเทียบเร็ว * sort เร็ว * sync ข้ามระบบ มัน ไม่จำเป็นต้องผูกกับ create/update หลายระบบมีทั้ง created_at และ timestamp พร้อมกันได้ ==== อันนี้น่าจะหมายถึง ฝั่ง frontend หรือ ORM มัน map field ให้ดูเหมือน relational join ==== เช่น: * ดึง document มาแล้ว populate user * หรือ query แล้ว merge object เข้าไป * ทำให้ UI เหมือนข้อมูลมาจากหลายตาราง ตรงนี้ไม่ผิด แต่คนละประเด็นกับเรื่อง timestamp โดยตรง ==== - CreatedAt / UpdatedAt = ชื่อฟิลด์ตาม convention ของ framework ==== * Timestamp = เวลาแบบ raw เอาไว้เทียบ/เรียงเร็ว * ใช้ต่างกันได้จริงระหว่าง: - SQL vs NoSQL - ORM แต่ละค่าย * ที่เถียงกันในโพสต์ = คุยกันคนละเลเยอร์ - คนหนึ่งพูดเรื่อง “โครงสร้างข้อมูล” - อีกคนพูดเรื่อง “การแสดงผล/การ join” มันเลยดูเหมือนเถียง แต่จริงๆ แค่ ไม่อยู่ในแกนเดียวกัน ถ้าจะฟันธงสั้นๆ แบบไม่อ้อม: : จบ.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)