sangita
sangita

Reputation: 191

Optimising mongodb schema

I have mongodb schema

{
  MyProduct: "testProduct_1",
  Module:    "Module_1",
  CreatedTime: "24-08-2009",
  MyMessage: "SomeMessage"

}

However MyProduct and Module are most of the time repeated entries, so I don't want to log it every time. How can I optimise this schema so that MyProduct and Module are written only once and (CreatedTime,MyMessage) are updated every time.

Upvotes: 0

Views: 116

Answers (1)

Salvador Dali
Salvador Dali

Reputation: 222541

The best optimization which I would do is to substitute your stringDate as a normal date (timestamp or date).

If you really want to optimize your myproduct/module, you can push it to application layer implementing the logic. If there is no module, than take myProduct thus storing it only if it is different.

Keep in mind that it is important to know what are you planning to do with your data before doing any kind of optimizations.

Upvotes: 1

Related Questions