0

I have some collections like user, posts, uploads

I want to create a single collection that contains everything so the front end has to query this one single collection to get all info about a post (eg: post is public or private, has uploaded image?, user ratings et al)

{
    "userName": "Chase",
    "userRating": "4",

    "postText": "This is a post",
    "postCount": "30",

    "imageSize": "10*1024",
    "uploadDate": "Dec2016"
}

I explored views but did not find a good tutorial that works with multiple collection (May be I am wrong!), Later I explored joins,but it needs a common entity between the three collection which I dont have.

Is there any way to reference data from multiple collection to one collection or view?

kbang
  • 694
  • 9
  • 25
  • If there's no common attribute between the entities, how you you query them now? What do the items look like? – craigcaulfield May 16 '18 at 08:12
  • Try using [$mergeObjects](https://docs.mongodb.com/manual/reference/operator/aggregation/mergeObjects/) this feature is available from version 3.6 – Clement Amarnath May 16 '18 at 09:19

0 Answers0