How should a limited number of history tables be designed

  mongodb, question

The database is MongoDB.

If there is a data table (data -collection)— Users.

Every time a User updates his data, he needs to keep one copy of historical data, but not too much, for example, only the latest five copies.

If a table UserHistory is specially designed to store old data, it is necessary to judge whether there are more than 5 new records each time, and delete the oldest if there are more.

Is this reasonable?

Is there a more reasonable design? …
Can this document answer your questions?