0

Say for instance I have a list of document objects that I am displaying and each time I click on that document, I want to save a timestamp to the database, in an field called 'clicked'.

{
   id: 1,
   clicked: ['timestamp1', 'timestamp2']
}

Should this field be an array of timestamps? It just seems like it would require a lot of effort to push an entire array every time just one timestamp is added. Would it make more sense to just make the clicked value a whole new collection or is there some other structure I'm overlooking?

iamcootis
  • 2,203
  • 3
  • 18
  • 22
  • 1
    You may configure it as sub collection than a array, then it must be easy to add new ones. – Manoj Jan 29 '20 at 03:58
  • Thanks for this, I made this post and a few hours later as my head hit the pillow, it dawned on me that this was the correct way to do this. – iamcootis Jan 29 '20 at 16:47

0 Answers0