[SERVER-30756] How to join collection where foreign field is an array? Created: 21/Aug/17 Updated: 31/Aug/17 Resolved: 30/Aug/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Irshad Ansari | Assignee: | Mark Agarunov |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
I am working with mongodb and need help to join collections where the foreign field is a value in an array. Collection 1:
collection 2:
collection 3:
Now as per above collections I need to aggregate users and need to join 'users' collection with 'agents' and 'properties'. The issue is that the collection 'properties' is having foreign field 'email' as a value in an array so i am not able to apply lookup on it. I need to join these collections with field 'email' but due to having foreign field 'email' as a value in an array in 'properties' collections I am not getting results. i am hereby showing my attempt as below
Can anyone help me out please. |
| Comments |
| Comment by Irshad Ansari [ 31/Aug/17 ] |
|
Hello Mark, sorry, i was not aware of this, i'll take care of this in future. Thanks |
| Comment by Mark Agarunov [ 30/Aug/17 ] |
|
Hello irshadahmed.ansari@gmail.com, Thanks for your report. Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-user group. Thanks, |