meteor-astronomy: Nested class as array - bug in saving

Reproduction Repo: https://github.com/s7dhansh/meteor-astronomy-bug

Steps:

  1. Have a nested array in an astro class
  2. Instantiate the parent class
  3. Save it
  4. ‘Set’ the nested class
  5. Push the nested class into parent class key
  6. Save it again

It throws an error saying: MongoError: Cannot update <nestedClass> and <nestedClass.0.nestedClassField> at the same time.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 23 (11 by maintainers)

Most upvoted comments

I should mention that in the example I gave before, I first set the new response via:

obj.set('responses.0', new SL.M.EndpointResponse());
obj.set('responses.0.codes', [200,500]);
obj.save(); // error

That is a very simplified example. In reality, those steps happen in disparate parts/components of my app. Otherwise I’d obviously do a simple:

obj.set('responses.0', new SL.M.EndpointResponse({codes: [200, 500]}));
obj.save();