mongodbunit-testingspring-bootspring-data-mongodbfongo

Spring boot Embedded MongoDb data prefilled


I want to know if there are any tools like Flyway which can assist in database initialization / migration for mongodb. Some of the thoughts I had is

  1. I have used flapdoodle as embedded mongo with springboot. This works fine but, I need to manually put data into it.
  2. For Junit tests with mongo db, I use nosqlunit. This works perfectly fine with Fongo(Fake mongo). It has support to read data from a json file and prefill the database with data during startup. But this works only with junit, since this is a JUnit extension.

What I am looking for is a mix of both of the above, an embedded mongo which works not only with JUnit and can prefill data from a given json(similar to V1__init.sql in Flyway)
Is there any such tool ?


Solution

  • Finally, I developed this simple version of data prefill for Mongo. Here is the code.

    https://github.com/pvpkiran/mongoprefill

    Given seed data, this Autoconfiguration fills up mongo.