2013-04-24 116 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是完成你想要做雖然什麼。