I have been thinking about following scenario for some time. I would like to ask you whether there is any solution the way I would like to solve it. And I understand that the whole idea might be wrong from the very beginning.

I have couple of different types of documents which describe, let us say, car and its parts:

// car
{
  _id: "car001",
  type: "car",
  lastModification: "2019-01-01"
}

// wheel
{
  _id: "wheel001",
  type: "wheel"
  carId: "car001",
  lastModification: "2019-01-02"
}

// light
{
  _id: "light001",
  type: "light"
  carId: "car001",
  lastModification: "2019-01-03"
}

The database lists many cars, lights and wheels. :o)

I would like to have following view as result: List of all cars sorted by lastModification of any part of that car. (List of cars which were modified the most recently.)

Is that even possible when the documents are modeled in this way?

0 Answers