[英]Defining types in mongoose schema
For a mongoose schema, is there a difference between name: String
and name: { type: String }
when defining types?对于 mongoose 模式,在定义类型时name: String
和name: { type: String }
之间有区别吗?
In Mongoose, name: String
is just a shorthand for name: {type: String}
.在 Mongoose 中, name: String
只是name: {type: String}
的简写。 Both versions are perfectly valid.两个版本都完全有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.