I was looking for transaction support to rollback the changes while doing testing my app written in Spring+RESt+Mongo 2.4. But its not possible since we cant use transaction for mongodb.
Transactions aren't supported, but you do have a few alternative approaches for rolling back changes while testing:
- create/reset data as needed during set up or tear down in your unit tests
- seed your initial data set and start
mongod
with--syncdelay=0
during your testing so no new data is written to disk (Embedded MongoDB suggests this as a "snapshot" approach)
While searching about integration testing I found few links about embedMongo for doing integration testing. You can also do integration testing by having dedicated mongo db instance running somewhere. What special feature that embed mongo provides?
Embedded MongoDB is a wrapper around the standard MongoDB Server binaries intended to help with unit testing. The "special features" of the wrapper are just functions to start/stop MongoDB instances via your unit tests.
Also see the comments on: Embedded MongoDB when running integration tests.
I didn't find great documentation for it, Is it under Apache license?
The "Embedded MongoDB" source files on GitHub suggest Apache 2.0 license.
The MongoDB server binaries will use the standard MongoDB Server community license, which is AGPL v3.0.