Created
September 12, 2013 15:22
-
-
Save jaredly/6539312 to your computer and use it in GitHub Desktop.
I would like to be able to in my mongoose schema specify an object with a variable number of keys whose corresponding values should all conform to a specified schema; similar to the ability to make an array with a variable number of elements who all follow a given schema. Is this possible?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"branches": { | |
"#keyname#": { | |
"name": String, | |
"count": Number | |
} | |
} | |
} | |
// such that the following would be validated | |
{ | |
"branches": { | |
"master": { | |
"name": "Yours", | |
"count": 4 | |
}, | |
"second": { | |
"name": "Mine", | |
"count": 20 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment