2016-08-15 17 views

回答

5

不,他們沒有編入索引,你必須自己編制索引,就像其他領域一樣。

animalSchema.index({"createdAt": 1}); 
animalSchema.index({"updatedAt": 1}); 
+0

讀者注意:'1'表示升序,而不是'true'。對於那些不經常製作網站級別mondodb索引([未明確記錄](http://mongoosejs.com/docs/guide.html#indexes))的用戶,「-1」表示降序。 – steampowered