jkuehn / gorm-mongodb

Grails GORM implementation for the MongoDB document oriented database
http://www.grails.org/plugin/mongodb-morphia
Apache License 2.0
21 stars 14 forks source link

Domain.list() return MorphiaIterator when GORM semantics are slightly different #13

Closed andrew-nguyen closed 12 years ago

andrew-nguyen commented 12 years ago

I am new to grails and recently moved from the mongodb plugin to this plugin. I pass a Domain.list() from my controller to gsp file. This plugin returns a MorphiaIterator while the gsp expects something more along the lines of a list. I'm not sure what grails/gorm actually uses but the semantics are different enough that I need to create my own list from the MorphiaIterator.

jkuehn commented 12 years ago

Yes this behaviour differs from most other gorm implementations. It is intentional though. In case of large result sets it is more memory friendly. How would you like to use it in your gsp? The <g:each tag should have no problems with the iterator.

If you need an actual list, you can use groovys List converter: Domain.list().toList()