Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Support whole-document updates #33

Closed
realyze opened this issue Jul 16, 2017 · 2 comments
Closed

Support whole-document updates #33

realyze opened this issue Jul 16, 2017 · 2 comments

Comments

@realyze
Copy link

realyze commented Jul 16, 2017

I have a displayableLocation field which I compute via autoValue when address field is set (essentially adding random "jitter" to the provided address). I'm returning an object from autoValue like so:

displayableLocation: {
  type: Object,
  autoValue: function () {
    // other logic
    return {
      address: '...'
    }
  }
}

However when I call MapEnitites.update({_id: entity._id}, entity), autoValue adds the displayableLocation.address field under a $set modifier so I end up with a half-modifier, half-document and collection2 reports Expected '_id' to be a modifier operator like '$set'.

Can I actually use whole documents with update?

@aldeed
Copy link
Owner

aldeed commented Nov 13, 2017

Whole-doc updates not currently supported, though you can always validate it yourself and then do the update with bypassCollection2: true option

@aldeed aldeed changed the title How to use autoValue when passing whole document to update? Support whole-document updates Nov 13, 2017
@aldeed
Copy link
Owner

aldeed commented Feb 2, 2018

@aldeed aldeed closed this as completed Feb 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants