Hello everyone! I am Samuel and I am a young web developer. Actually I am working in a project to help my family's business.
The system is about access control to a vehicle with QR codes. It is composed by a web application (Angular6), mobile application (Ionic3) and REST API (NodeJS) connected to a noSQL DB (MongoDB).

One of my collections is Reservations and the document is structured as follows:

{
_id: number,
serviceId: number,
datetimePaid: Date,
responsible: Person,
state: string,
tickets: Tickets[],
}

And Tickets is something like:

{
price: number,
passenger: Person,
roundtrip: boolean
}

A reservation could be modified by users with differente roles (with higher or lower privileges) but I need to track whenever an user has modified some field of the document to give the administrator a good way to solve possible problems.
The operations or fields that could be updated are:

  • datetimePaid
  • responsible (replace it with another Person)
  • state
  • tickets[i].passenger
  • Add or remove elements from the tickets array

I haven't find any native solution provided by MongoDB to it, and I have couple of ideas but I would like to hear your strategies or ways to do it.

Many thanks in advance

Logo

MongoDB社区为您提供最前沿的新闻资讯和知识内容

更多推荐