0

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.

sangita
  • 191
  • 5
  • 14
  • Are you sure you want to use a NoSQL solution like MongoDB if you're asking questions like this? Look at the accepted answer at this question: http://stackoverflow.com/questions/10553860/nosql-use-case-scenarios-or-when-to-use-nosql – marijnz0r May 01 '15 at 12:39

1 Answers1

1

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.

Salvador Dali
  • 214,103
  • 147
  • 703
  • 753