Nested fields for citibike.trips

Hi everyone,

I’m wondering after watching the lesson about nested fields : why is there 3 fields in the document citibike.trips for each end station (id, location, name) instead of having 1 like :

  • end station
    > id : int32
    > location : coordinates
    > name : string

13

Is this because Compass doesn’t work well with nested fields ?

Thanks for explanations,

Joris

We have nested fields in various collections. And I don’t believe schema design is anywhere decided on Compass. Compass is just a tool which is used to access Mongo data.

But I appreciate your concern on the schema design. :slight_smile:

Kanika

1 Like

@Joris_SAIDANI_37802 To expand on what @Kanika said, if you look at the 100YWeatherSmall db (the data collection), you can see example of nested documents. The document schema is designed by the user, within the constraints of what MongoDB lets it store (which is pretty flexible on that front), and Compass is just a visualization / management tool for that data. Here is a link that talks a bit about embedded documents:

https://docs.mongodb.com/manual/core/data-modeling-introduction/#flexible-schema

HTH,
Mike