How to create a definition for a multiple nested collection/object

very new to programming I’m not quite sure how to do this.
Because of the denormalization “required” for mongodb I have the following model:

var product= { name: "string", picture: "url", manufacturer: "string", price: { //should be array validFrom: "dateTime", validTo: "dateTime", added: "dateTime", current: "boolean", store: { //should be array id: "id of Store in collection", name: "string", geoLocation: "dontnowyet" } } }

I now would like to create a function, class, object… which i can call with the nested values so and then use the object insert it into mongodb.
What is the best way to do this? Do i need ES6 classes with extend?

grrrrr okay also don’t know how to ident the code…

you can simply use <pre> or <code> or tripple ticks with a content designator, like

//this will be formatted like javascript
var x = function() {}

It’s not clear what you need. Are you looking for something like an ORM/ODM? Have you looked at mongoose?

Sorry for the late response.
I wanted to create an object (Product) which has a property price (also an object)
and another property store (also an object).
I wasn’t sure how on how to create them so to properly use them in Meteor.
Anyhow I now went for 3 separate objects/collections with references pointing on each other.