I have been struggling to insert objects into an array on the Meteor user document and keep getting errors with my query. I am trying to achieve similar structure as how emails are stored using the accounts package.
ie
below is my schema
tenants: {
type: Array, //Object
optional: true,
blackbox: true
},
“tenants.$.id”: { // the organisation is
type: String,
},
“tenants.$.name”: { // the organisation is
type: String,
},
and my update query as below
> _id: Meteor.userId(),
> modifier: {
> $set:{currentType: "special", currentTenant: "tenantId"},
> $push: {
> 'tenants': {
> 'tenants.id':"tenantId",
> 'tenants.name': "test tenantname"
> }
> }
> }
have tried so many different version and keep getting so many errors. This current version give no errors but doesn’t insert either.
the push part of the query just fails or does nothing.
Im using collection2, simplscema etc
Please help @hwillson