Mongoose version >= 4.0 has a timestamps option which creates an updatedAt
and createdAt
field for schemas when timestamps
is set to true
.
http://mongoosejs.com/docs/guide.html#timestamps
Are the updatedAt
and createdAt
fields indexed?
Mongoose version >= 4.0 has a timestamps option which creates an updatedAt
and createdAt
field for schemas when timestamps
is set to true
.
http://mongoosejs.com/docs/guide.html#timestamps
Are the updatedAt
and createdAt
fields indexed?
No they are not indexed, You have to do indexing by yourself, like any other field.
animalSchema.index({"createdAt": 1});
animalSchema.index({"updatedAt": 1});