D
D
daclip2015-06-19 19:34:17
MongoDB
daclip, 2015-06-19 19:34:17

Is this denormalization normal in Mongodb?

Good afternoon. Recently started using MongoDb and got a question about denormalization.
Introductory
MediaCollection

{
 "_id": ObjectId("5584367e44ae3e41ad5481a3"),
 "createdAt": ISODate("2015-06-19T15:34:22.927Z"),
 "title" : "CD",
 "properties": [
   {"title": "format", value: "digital"},
   {"title": "material", value: "plastic"}
  ]
}
{
 "_id": ObjectId("5584367e44ae3e41ad5481a4"),
 "createdAt": ISODate("2015-06-19T15:34:22.927Z"),
 "title" : "Vinyl",
 "properties": [
   {"title": "format", "value": "analog"},
   {"title": "material", "value": "vinyl"},
   {"title": "size", "value": "12in"},
  ]
}

Music Collection
{
 "_id": ObjectId("5584367e44ae3e41ad5481a8"),
 "createdAt": ISODate("2015-06-19T15:34:22.927Z"),
 "artist" : "Pink Floyd",
  "title": "The Wall",
 "properties": [
   {"title": "year", value: "1988"},
   {"title": "style", value: "Rock"}
  ],
  "media": {
    "_id": ObjectId("5584367e44ae3e41ad5481a4"),
    "createdAt": ISODate("2015-06-19T15:34:22.927Z"),
    "title" : "Vinyl",
    "properties": [
      {"title": "format", "value": "analog"},
      {"title": "material", "value": "vinyl"},
      {"title": "size", "value": "12in"},
     ]
   }
}

Questions:
1. Is such a strong denormalization normal for MongoDb?
2. Is it normal to update the media fields in all MusicCollection records when changing any document in the MediaCollection?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Shikanov, 2015-06-19
@dizballanze

This is too much, IMHO, in this case it is better to add ObjectID from MediaCollection.
I don’t see any advantages in such a decomposition, but there are a lot of problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question