更新时间:2023-11-26 10:45:10
当某个字段存在于 MongoDB 文档中,但未在您的 Mongoose 架构中定义时,就会发生这种情况.
This will happen when a field is present in the MongoDB document, but not defined in your Mongoose schema.
因此请务必在您的 ServerModel
架构中将其定义为
So be sure to define it in your ServerModel
schema as
ip: String
或者,要访问它,即使它未在您的架构中定义,请使用 get
方法:
Or, to access it even though it's not defined in your schema, use the get
method:
console.log(server.get('ip'));