Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoValue documentation for docId is misleading. #402

Open
OliverColeman opened this issue Dec 2, 2019 · 2 comments
Open

autoValue documentation for docId is misleading. #402

OliverColeman opened this issue Dec 2, 2019 · 2 comments
Milestone

Comments

@OliverColeman
Copy link

Just spent some time figuring out why a findOne(this.docId) in an autoValue function was causing an error. The documentation for this.docId says docId: The _id property of the document being inserted or updated but it turns out it's not just the _id of the document, it's a filter query like { '$in': [ 'rg8gSYhGaNQaJ3X8p' ] }.

@coagmano
Copy link
Member

coagmano commented Dec 3, 2019

I think the docs represent the original intention, but if an update uses a query in the selector, it will be used instead as a result of this code:

  } else if (type === "update" && selector) {
    docId = typeof selector === 'string' || selector instanceof Mongo.ObjectID ? selector : selector._id;
  }

source

Not sure what the "correct" behaviour here should look like

Want to make a PR to update the docs?

@CaptainN
Copy link
Contributor

Is this the correct behavior? I would think the property should be made to always return a document id, as documented, and intuitively.

@StorytellerCZ StorytellerCZ added this to the v4 milestone Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants