Update index.js

1. For users like me who define _id of doc before it's saved for the first time. (Old code didn't create field createdAt if doc already had _id)
2. For existing doc without field createdAt, adds field createdAt automatically when doc is saved next time.