这实际上是两个问题。
使用MongooseJS
答案 0 :(得分: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来完成您尝试做的事情。