We are trying to save profile views.
We created a schema something like that
{
user: userId,
viewers: []
}
We think the viewers array could have millions of items
So would it make more sense to do it this way?
{
user: userId,
viewer: viewerId
},
{
user: userId,
viewer: viewerId
},
{
user: userId,
viewer: viewerId
}
In this way this collection could have millions of documents
What is the best way to handling this
CodePudding user response:
I think this would be better, it's way more easy to analyze data. And will not cause the limit of 16mb in one document.
{
user: userId,
viewer: viewerId
},
{
user: userId,
viewer: viewerId
},
{
user: userId,
viewer: viewerId
}