Is it possible to have a nested collection inside a List object ? Similar to mongoose sub documents
http://mongoosejs.com/docs/subdocs.htmlFor example I want to have an Order list which consists of order date and array of order items:
Order.add({
date: { type: Types.Date, default: now() },
orderItems: [{
product: { type: Types.Relationship },
price: { type: Types.Money }
}]
})
Then it would be convenient to have these orderItems be manageable straight inside order object in admin panel.
Sure, I could make orderItems as a relationship and manage it as a seperate list, smth like this:
Order.add({
date: { type: Types.Date, default: now() },
totalCost: { type: Types.Money },
orderItems: { type: Types.Relationship, ref: 'OrderItem', many: true}
})
OrderItem.add({
order: { type: Types.Relationship, ref: 'Order' },
product: { type: Types.Relationship, ref: 'Product' },
price: { type: Types.Money }
})
But if i had order item in separate list it would mean that I could accidentally move it to another order, what would be definitely a mistake. Order item may be created inside specified order or deleted, but cannot be moved to another order.
This approach would also simplify content management I think.
How do you manage in such cases and how do you think what is a best approach ?
Btw, thanks for what you are doing, it's amazing :)