-
Notifications
You must be signed in to change notification settings - Fork 67
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
Calling meteorMethod fails if document doesn't contain all fields #649
Comments
I have a strong hunch It's lurking somewhere here: f056af9 |
Ok, I figured out the cause in this case: I had declared my "sort" -behavior like so: behaviors: {
sort: {
orderFieldName: 'order',
hasRootField: true,
rootFieldName: 'userId', // <--- culprit
}
} If I add This changed in Here is the forked version of sort-behavior I'm using: https://github.com/arggh/meteor-astronomy-sort-behavior/tree/v2 Should I close this issue or should it be given some thought? |
You could actually extend definition by adding the if (this.options.hasRootField) {
definition.fields[this.options.rootFieldName] = {
type: String,
optional: true,
default: null
};
definition.events.beforeFind = (e) => {
const doc = e.currentTarget;
const options = e.options;
if (options.fields) {
options.fields[this.options.rootFieldName] = 1;
}
};
} So I'm closing this issue as it's not related with some bug in Astronomy. |
I noticed a strange issue after updating to newest Astronomy.
One part of my app that I haven't touched in ages wasn't working anymore.
It's a simple scenario, where I fetch my data with only some of the fields included.
Then at some point I would then call a
meteorMethod
on one of these documents, provided via Astronomy behavior (one I forked from your sorting-behavior).It used to work with
v2.3.x
, but after updating to all I get isI pin-pointed the bug to have appeared in
v2.4.7
. The same issue is also present on the newest release.If I remove the
fields
- attribute from the method that gets my documents, it works withv2.4.7
and above.The text was updated successfully, but these errors were encountered: