Anonymous committed e894002

Clarify runtime type of argument to DBCursor#sort to prevent "ambiguous method overloading" GroovyRuntimeException when GMongo is in use

Comments (0)

Files changed (1)


 package grails.mongeez
 import com.mongodb.BasicDBObject
+import com.mongodb.DBObject
 import com.mongodb.QueryBuilder
 import java.text.SimpleDateFormat
 import org.apache.commons.lang.time.DateFormatUtils
         def dbColl = getMongeezCollection()
         def query = QueryBuilder.start('type').is('changeSetExecution').get()
         // TODO: get a single way to determine the true order of existing executions... finer grained date
-        def changeSetExecutions = dbColl.find(query).sort(new BasicDBObject([date: 1, resourcePath: 1])).toArray()
+        def sort = new BasicDBObject([date: 1, resourcePath: 1])
+        def changeSetExecutions = dbColl.find(query).sort((DBObject)sort).toArray()
         def dateFormatter = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT
         def datePattern = dateFormatter.getPattern()
         def dateParser = new SimpleDateFormat(datePattern)