-
Notifications
You must be signed in to change notification settings - Fork 96
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
Populate 2 levels deep #320
Comments
IV tired this :
But no luck |
@daffl any idea how to do this please? |
@ekryski you got any ideas ? |
Set |
@daffl So this is not possible with the query string ? im going to have to create a custom hook to populate 2 levels ? |
You could try the querystring representation of the query ( |
@daffl |
The code sample I showed should show how it looks: const qs = require('qs');
const query = qs.stringify({
$populate: {
path: 'pages',
populate: {
path: 'components',
model: 'Component'
}
}
});
console.log(query); This will print something like |
Oh right i see ! Sorry i misunderstood, thanks a lot ill give it a test |
😬 |
Thanks @daffl This one works magically. Just a question, from this, can we also do a condition 2 levels down? |
I am a bit confused here. The Feathers app should be using app.use(express.urlencoded({ extended: true })); in app.js. So if you are using the proper "nested query syntax", then the query should be parsed correctly. Try these solutions out. Mongoose should support a couple of different syntax for populate. // Mongoose supports space delimited string
&populate=attachments attachments.creator
// will become
q.populate('attachments attachments.creator')
// Mongoose supports array of strings
&populate[0]=attachments&populate[1]=attachments.creator
// will become
q.populate(['attachments', 'attachments.creator']) |
Hello, wandering if this is possible ?
creator is a ID REF inside the attachment table to a user
Currently its only populating attachments which is good, but also need to populate creator inside the attachments if possible,
Thanks !
Luke
The text was updated successfully, but these errors were encountered: