Hello,
I’m trying to have a collection with an object inside it.
E.g if I have a collection of
Cars = new Mongo.Collection('cars');
And a simple schema of:
CarsSchema= new SimpleSchema({
engine: {
type: String
},
brakes: {
type: String
}, //etc
});
I want to have something like this
CarsSchema= new SimpleSchema({
engine: {
type: Object {
name: String ,
make: String,
price: Number,
},
brakes: {
type: Object {
name: String ,
make: String,
price: Number,
}, //etc
});
What’s the best way of doing this?
Also, when it comes to inserting data into these objects, how can I do it?
Would it be something similar to
Cars.engine.insert({ name: inputName, make: inputMake, price: inputPrice)};
If not, how can I insert?
I want to stay away from Autoform, as I’m still in the process of learning, and I couldn’t find a good tutorial about Objects in Collections.
I truly appreciate the time, thank you!