joelittlejohn / embedmongo-maven-plugin

Maven plugin wrapper for the flapdoodle.de embedded MongoDB API
Apache License 2.0
88 stars 51 forks source link

Ease of use mongo-import goal #52

Open yacota opened 8 years ago

yacota commented 8 years ago

In https://github.com/joelittlejohn/embedmongo-maven-plugin/issues/48 an easier way to import collections has been implemented, but I also think that being able to point to a "directory" instead of a single file(or list, whatever) would definetly increase the ease of use of this goal

<execution>
                <id>mongo-import</id>
                <phase>process-test-resources</phase>
                <goals>
                  <goal>mongo-import</goal>
                </goals>
                <configuration>
                  <imports>
                    <import>
                      <database>${mongodb.database.name}</database>
                      <file>${basedir}/src/test/resources/mongodata</file>
                    </import>
                  </imports>
                </configuration>
              </execution>

In mongodata I have a few dozen of json files which are created by following the convention described in issue https://github.com/joelittlejohn/embedmongo-maven-plugin/issues/48.

joelittlejohn commented 8 years ago

Sounds good to me. I don't think we need to search directories recursively (this can introduce new edge-cases and issues) but definitely iterating every file in a given directory would be good.

Happy to accept a pull request for this if you have the time.

joelittlejohn commented 8 years ago

Ah, I just saw your pull request! :smiley: