Thursday 18 May 2017

Mongoose/Mongodb Cross Collection Transactions/Rollbacks

I will preface with I know mongodb isn't designed to be heavily bound by reference based relationships (Thats what good ol SQL is for), but I have inherited a very heavily reference based mongoose schemas. Pretty much everything is reference bound between different collections. Its really close to how a traditional SQL DB looks.So to my understanding mongodb has transactional locking at the document level, but it doesn't support cross collection transaction protection. I am debating on writing a functional wrapper above mongoose to protect against creating orphan/malformed records (these really aren't documents). Has anyone else had a similar scenario or know of any libraries that assist in this issue. Refactoring isn't an option at this point.Any suggestions are greatly appreciated, thanks in advance.

Submitted May 18, 2017 at 06:30PM by moaxaca

No comments:

Post a Comment