2013-04-24 123 views
3

这实际上是两个问题。猫鼬子文档排序

使用MongooseJS

  1. 你可以设置一个架构中的默认排序顺序?
  2. 你能控制子文档的排序方式吗?
+0

我不确定答案。我可以谷歌周围,也许看代码,但也许如果你解释你想要完成的,有人可以提供另一种方法。 – kentcdodds 2014-04-15 16:07:56

回答

0

看着它看起来像这样的options available for Schema creation不是一种可行的选择:

autoIndex: bool - defaults to true 
bufferCommands: bool - defaults to 
true capped: bool - defaults to false 
collection: string - no default 
id: bool - defaults to true 
_id: bool - defaults to true 
minimize: bool - controls document#toObject behavior when called manually - defaults to true 
read: string 
safe: bool - defaults to true. 
shardKey: bool - defaults 
to null strict: bool - defaults to true toJSON - object - no default 
toObject - object - no default 
versionKey: bool - defaults to "__v" 

您可以做出plugin是完成你想要做虽然什么。