Currently, I’m using a small child document to reference other collections:
{ name: 'xxx', id: 'xxx'}
.. instead of a manual reference.
So, for a forum post, I might have this:
{
title: 'Some title',
creator: { name: 'jgauffin', id: ObjectId(123445455) },
posts: [...]
}
The reason is that I do not have to do any lookups in other collections each time I fetch a document, and names hardly change.
But since I’m new to this, are there any established design patterns for this? Or are you supposed to do $lookup even for a single field in other collections?