JackAdams / meteor-transactions

App level transactions for Meteor + Mongo
http://transactions.taonova.com/
MIT License
113 stars 16 forks source link

Growing transactions collection #87

Closed sungwoncho closed 7 years ago

sungwoncho commented 7 years ago

Versions


The transactions collection in my app has been constantly growing. Currently,

db.getCollection('transactions').count({})
// => 36

It takes up a lot of space. Is this supposed to happen? Can I empty the collection? There is no one using the transaction at the moment.

JackAdams commented 7 years ago

Yes, the transactions collection on my app is an order of magnitude bigger than any other collection most of the time. Occasionally, I just blow it all away with a manual db.transactions.remove({}), as I don't use it for anything but a temporal undo/redo stack for the last five minutes.

It just grows -- docs are added but never removed. This is by design but, in practice, not many apps are going to need a record of the entire history of the transactions.

See #15 where the pros and cons of having a method for clearing out old transactions were briefly discussed.

If I was worried about the size of the collections, I'd probably do a synced-cron job to clean up anything older than six months every week or so.

sungwoncho commented 7 years ago

@JackAdams thanks. I will close this for now.