I am using Firebase with Nodejs. I want to limit number of records inbattleReports
by number N. But not just limit. If new data will come and there is already N records in battleReports
, delete oldest one and add new one. I want to implement something like circular queue or buffer. Is it possible?
players: {
'player1-id': {
battleReports: {
'battle-report-1': {/* report object */},
'battle-report-2': {/* report object */},
'battle-report-3': {/* report object */}
// ...
}
},
'player2-id': {
battleReports: {
'battle-report-1': {/* report object */},
'battle-report-2': {/* report object */},
'battle-report-3': {/* report object */}
// ...
}
},
// ...
}