This is the format of my document:
{
_id: some id,
name: 'some name',
versions: []
}
In the versions field I store objects like {v: '2.5', count: 5} where count holds the number of times a version is in used.
What is the simplest way to do the following?
- Insert a new object inside the
versionsarray if it doesn't exist - Ff a particular version exists inside the
versionsarray then increment itscount