如何获得 Mongoose 集合的完整模式定义?

How can I get the full schema definition of a Mongoose collection?

包括属性、类型等?我想要得到的,本质上是:

{
    label: {
        type: "String",
        required: true
    },
    published: {
        type: "Boolean",
        default: true
    }
}

仅 returns 调用 mongoose.model('someModel').schema.paths StringNumberObjectId 的 属性 类型,所有其他都是 undefined.当我在 GitHub 问题队列中阅读此信息时,似乎此信息(schema.paths[path].instance 属性)是内部信息,甚至不应该首先使用。

如果是这种情况,如何以编程方式获取模式定义?

未回答此问题的相关问题:

相关 GitHub 问题:

这已合并到 Mongoose 4.0.0 中:https://github.com/Automattic/mongoose/issues/1938