Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. db.getCollection('article').aggregate([
  2. {$match: {$or: [
  3. {"view.sections.parts.embed.provider_name": {$in: ['Commerce Product', 'Image With Hotspots', 'Commerce Product Group']}},
  4. {"view.sections.steps.parts.embed.provider_name": {$in: ['Commerce Product', 'Image With Hotspots', 'Commerce Product Group']}}
  5. ]}},
  6. {$project: {_id: 1}
  7. ])
  8.  
  9. db.getCollection('article').aggregate([
  10. {$match: {$or: [
  11. {"view.sections.parts.embed.provider_name": {$in: ['Commerce Product', 'Image With Hotspots', 'Commerce Product Group']}},
  12. {"view.sections.steps.parts.embed.provider_name": {$in: ['Commerce Product', 'Image With Hotspots', 'Commerce Product Group']}}
  13. ]}},
  14. {$project: {
  15. "provider_names": {
  16. $reduce: {
  17. input: {$concatArrays: [
  18. {$ifNull: ["$view.sections.parts.embed.provider_name", []]},
  19. {$ifNull: ["$view.sections.steps.parts.embed.provider_name", []]}
  20. ]},
  21. initialValue: [],
  22. in: { $concatArrays : ["$$value", "$$this"] }
  23. }
  24. }
  25. }}
  26. ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement