schema with variable key?
See original GitHub issueHi,
Is it possible to define a schema when a key is variable.
Example of 2 objects:
{ 123: { firstname: "firstA", lastname: "lastA" } }
{ 124: { firstname: "firstB", lastname: "lastB" } }
Issue Analytics
- State:
- Created 9 years ago
- Comments:9
Top Results From Across the Web
How to use mongoose model schema with dynamic keys?
i'm using mongoose with nodejs, and i need to create a dynamic schema model, this is my code ...
Read more >Variable Key Names for objects
Variable Key Names for objects · jrconlin · Marak Squires · Kris Zyp · Marak Squires · Roland Bouman · Seth Wessitsh ·...
Read more >Mongoose Query with Dynamic Key that also contains the " ...
So I'm trying to query my MongoDB database using Express & mongoose to fetch documents that have a specific family AND a specific...
Read more >Mongoose v6.8.2: SchemaTypes
The type Key. type is a special property in Mongoose schemas. When Mongoose finds a nested property named type in your schema, Mongoose...
Read more >Variables ($vars) | Opis JSON Schema
Variables provide a new way to tackle different scenarios where JSON schema alone fails. This means, that you can use a new keyword...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved a similar problem by setting
strict
tofalse
as suggested, and then unsetting and setting the object in question like this:@znorman-harris this feature’s been in Mongoose for quite a while, see maps