Search code examples
javamongodbmoduleplayframeworkmorphia

play framework 1.2.4 - Morphia 1.2.9 - _id type incorrect for batch insert


According to the play morphia documentation you perform a batch insert using this syntax:

List<MyModel> myModels = ...;
MyModel.insert(myModels);

However whenever I do a batch insert the _id for the inserted rows is always a String hash:

{ "_id" : { "$oid" : "50149be2d5522755b6f564ce"} , ...

I am expecting a Long by default as I have set morphia.id.type=Long in application.conf. Inserting a row using a .save() gives me the expected result.

How can I perform a batch insert that uses the default _id type?


Solution

  • This is an known issue on v1.2.9: https://github.com/greenlaw110/play-morphia/issues/89

    The fix will enter the next release version.