2016-08-15 18 views

回答

5

不,他们没有编入索引,你必须自己编制索引,就像其他领域一样。

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

读者注意:'1'表示升序,而不是'true'。对于那些不经常制作网站级别mondodb索引([未明确记录](http://mongoosejs.com/docs/guide.html#indexes))的用户,“-1”表示降序。 – steampowered