Can a capped collection be used with txn?

38 views
Skip to first unread message

Davis Ford

unread,
May 9, 2015, 7:45:44 AM5/9/15
to mgo-...@googlegroups.com
I'm just wondering if instead of doing something like this: http://grokbase.com/p/gg/mgo-users/137gce3eq9/do-i-have-to-keep-txn-collection to have to clean up the txn collection I could use a capped collection?


Davis Ford

unread,
May 9, 2015, 8:24:42 AM5/9/15
to mgo-...@googlegroups.com
Sorry, I meant to say MongoDB TTL -- not necessarily a capped collection.

Gustavo Niemeyer

unread,
May 20, 2015, 4:33:49 PM5/20/15
to mgo-...@googlegroups.com
Hey Davis,

No, it cannot be used with the txn collection because documents may still be referencing old transactions (even if they have been applied already), and the txn package will panic if it cannot find the transaction to verify its state, if necessary.

I suppose you want to prune the collection to maintain its size under control. Is that the case? I've been having a few conversations recently about that as well, so maybe we can integrate some stock pruning feature that everybody can benefit from.



--
You received this message because you are subscribed to the Google Groups "mgo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mgo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Davis Ford

unread,
Jan 18, 2017, 3:13:04 PM1/18/17
to mgo-users
Hi Gustavo,

Any chance you'll reconsider this?  It would be super helpful to add a bson Date field to the pending collections that the txn package uses and have it insert time.Now().

This would allow us to add a TTL index that would expire those records after however many seconds we choose.  I understand the lib will panic if the data is not consistent, but I'm talking 30-60 days after -- I'll never need those records.

I currently have to go in and manually prune these collections every couple of months, and it is a real pain.

Would you consider a PR that adds a bson Date field and populates it for the pending collection that tx uses?

Regards,
Davis
Reply all
Reply to author
Forward
0 new messages