jagi / meteor-astronomy

Model layer for Meteor
https://atmospherejs.com/jagi/astronomy
MIT License
604 stars 67 forks source link

Updating "sub class" isn't working #714

Closed dnish closed 4 years ago

dnish commented 4 years ago

Hey, I'm trying to update a value of an Astronomy sub class. Given is the following example:

File: {
 _id: String,
name: String
locationData: LocationObject
}

LocationObject:
{
  url: String,
  serverId: String
}

In my case, I'm doing the following query:

const file = File.findOne();
file.locationData.url = file.locationData.url.replace("old","new");
file.save(e => console.log(e));

The changed url isn't stored, also there is no error given (I even tried the validate method). The file.getModified() method returns an empty array.

If I do change the name field, the changed name is stored, but the url still has the old value.

dnish commented 4 years ago

Can be closed, the problem occured because we did a "on the fly change" on the init method.