You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ekryski I think $populate is not documented anywhere. I only want few specific fields returned for the populated documents. I can do this with Mongoose like this
Story
.findOne({ title: /timex/i })
.populate('_creator', 'name') // only return the Persons name
.exec(function (err, story) {
if (err) return handleError(err);
console.log('The creator is %s', story._creator.name);
// prints "The creator is Aaron"
console.log('The creators age is %s', story._creator.age);
// prints "The creators age is null'
})
@ansarizafar currently you'd have to do that in a hook or a series of hooks. Right now the query syntax doesn't support applying special query params to populated models.
In all honesty we are currently working out the best way to handle this. This is one of the strengths of GraphQL so we are evaluating that to see if it makes more sense to lean on GQL instead of adding this functionality ourselves. Stay tuned for that!
In the mean time you need to use a server side hook if you want to reduce what is returned from the server. If you are just trying to normalize the response for your client side code (say a component only getting what it needs) you can add a client side after hook for the find method on your customerService.
I'm going to close this, but feel free to comment if that doesn't make sense. I think in reality this actually a couple different issues that still need to be figured out. Thanks for asking @ansarizafar!
@ekryski I think $populate is not documented anywhere. I only want few specific fields returned for the populated documents. I can do this with Mongoose like this
I am using this code with feather client
How can I only return name field from area service?
The text was updated successfully, but these errors were encountered: