I followed this article in MongoDB Docs and have created a similar one-to-many relationship, only referencing the "publisher" by id
value in the children. The data structure is as follows, publisher_id
being the working piece here:
{
_id: 123456789,
title: "MongoDB: The Definitive Guide",
author: [ "Kristina Chodorow", "Mike Dirolf" ],
published_date: ISODate("2010-09-24"),
pages: 216,
language: "English",
publisher_id: "oreilly"
}
{
_id: 234567890,
title: "50 Tips and Tricks for MongoDB Developer",
author: "Kristina Chodorow",
published_date: ISODate("2011-05-06"),
pages: 68,
language: "English",
publisher_id: "oreilly"
}
If I have a page, for example, with all O'Reilly books, how can I return those objects with the proper publisher_id
. Is this typically done on the front-end or the back-end?