I need to design a schema in mongoDB for an AngularJS project, but the json keys are dynamic. The structure of the json is as follows:
{
“1” : {
“Name” : “John”,
“City” : “London”
},
“2” : {
“Name” : “Paul”,
"City” : “New York”
}
}
The keys are variable and will always be in integer format. However, for the values, I can define my schema using Javascript like this:
var dbObject = new Schema({
Name: String,
City: String
});
I'm uncertain about how to incorporate the integer key into this schema. Any guidance on creating a schema object in mongoDB for this scenario?