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

Fields asked in queries are not always in the response, depending on their order #386

Open
vparpoil opened this issue Oct 15, 2019 · 2 comments · May be fixed by #388
Open

Fields asked in queries are not always in the response, depending on their order #386

vparpoil opened this issue Oct 15, 2019 · 2 comments · May be fixed by #388
Labels

Comments

@vparpoil
Copy link
Contributor

I just ran into what seems to be a bug :

Those two queries don't give the same result, query 1 will return the authorId, but query2 won't (it will though be present in author._id)

    let grapherQueryOne = createQuery('grapherQueryOne', {
        Book: {
            name: 1,
            authorId: 1,
            author: {
                name: 1,
            },
        }
    });

    let grapherQueryTwo = createQuery('grapherQueryTwo', {
        Book: {
            name: 1,
            author: {
                name: 1,
            },
            authorId: 1,
        }
    });

Here is a reproduction : https://github.com/vparpoil/grapher-bug-in-fields-returned/blob/master/server/main.js

@theodorDiaconu
Copy link
Contributor

Nice. This is because when author is read, then it puts into the graph the field "authorId" is needed, but it marks it as scheduled for deletion. Then when we try to add it again, it already exists so we ignore it. But this is a very good find! Curious how this was not caught up by now!

@vparpoil
Copy link
Contributor Author

The PR referenced fixes the issue but I am not sure of the implications of the modification. Maybe it's better to change the function that is adding fields for deletion instead of tweaking the deletion itself as I proposed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants