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

Nested fields? #5

Open
maxpain opened this issue Dec 28, 2016 · 4 comments · May be fixed by #10
Open

Nested fields? #5

maxpain opened this issue Dec 28, 2016 · 4 comments · May be fixed by #10

Comments

@maxpain
Copy link

maxpain commented Dec 28, 2016

This package supports nested fields like { 'profile.name': true }?

@du5rte
Copy link
Owner

du5rte commented Dec 28, 2016

@Maxpain177 not at the moment, but shouldn't be too hard to implement

@georgyfarniev
Copy link

Hello. Thanks for creating this nice library! Any updates about this part? For example, I use pagination, and I want to create projection not for root, but for nested query fragment. My query looks like this:

query {
  total
  data { field1, field }
}

I would like to create projection only for data subquery. How is it possible?

@natac13
Copy link

natac13 commented Aug 14, 2019

Hey @du5rte

So I see this is an long standing issue and I was attempting to implement this feature since I would like to use it in a project I am currently working on.

I believe I have the functionality done, however I would like to add tests to make sure. While I was trying to get my tests to pass I notice that the MockDB was using the user.json file. So my projection as follows was not working.

{
   _id: true,
   'nested.level': 1,
   'nested.nested.level': 1,
   'nested.nested.otherField': 1
}

FYI I added another user and updated the resolver to include my nested fields.

Therefore I am asking if it would be alright with you if I changed the MockDB to using the MongoDB Jest setup? That way the resolver can query against mongodb directly, and the projection for the nested field will return the correct document shape.

@du5rte
Copy link
Owner

du5rte commented Aug 14, 2019

@natac13 Yeah, go for it! MockDB is a big nasty hack, definitely needs to be replaced

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

Successfully merging a pull request may close this issue.

4 participants