1

Including properties, types, etc? What I'm looking to get, in essence:

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

Calling mongoose.model('someModel').schema.paths only returns the property type for String, Number, and ObjectId, all others are undefined. When I read up on this in the GitHub issue queue it seemed that this info (the schema.paths[path].instance property) was internal and shouldn't even be used in the first place.

If that's the case, how can one get the schema definition programmatically?

Related questions that don't answer this:

Related GitHub issue:

Community
  • 1
  • 1
Charlie Schliesser
  • 7,851
  • 4
  • 46
  • 76
  • The `tree` property on the schema looks pretty close. You could also just save off your original schema definition object. What are you ultimately trying to do with this info? – JohnnyHK Feb 28 '15 at 16:54

1 Answers1

0

This got merged into Mongoose 4.0.0: https://github.com/Automattic/mongoose/issues/1938

Charlie Schliesser
  • 7,851
  • 4
  • 46
  • 76