O'Reilly logo

Lift Application Development Cookbook by Gilberto T. Garcia Jr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mapping referenced objects

In the last recipe, we learned how to embed one object into another using record. However, there are situations where it's better to just create a reference from one object to another. For example, let's say we are creating a system for a store and we'll need to generate some reports. It's not practical to embed order into the clients because if we did so, each time we wanted to generate a report related to orders only, we would have to fetch all clients to find the order in which we want to generate the report. So, in such situations, it makes more sense to create a reference between clients and their orders. This is what we'll learn in this recipe.

Getting ready

We'll evolve the project we used in the Connecting to MongoDB ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required