couchbaselabs / couchbaselabs/node-ottoman
[BUG] populate not working in nested array
- Dominant language
- TypeScript
- Stars
- 295
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
I have a model "accounts" with a users array, userId in users items referred to the users model.
but when I want to get a list of accounts or findOne, I can't get the user document by `populate`
```
const schema = new Schema(
{
...
owner: { type: Schema.Types.Reference, ref: "users" }, // Reference to Users (works),
users: [
{
userId: { type: Schema.Types.Reference, ref: "users" }, // Reference to Users (not works)
...
}
```
this my find service:
```
accountsModel.find(filters, {
populate: {
owner: ["firstName", "lastName", "email", "type", "id"],
users :{
populate: {
userId: ["status", "id", "firstName", "lastName", "email", "type"],
}
},
populateMaxDeep: 3,
});
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.