> First off, thanks for the shapes abstraction and the collection
> wrappers...that makes using Mongo with Scala top-notch.
Thanks!
> I'd like to examine the underlying queries being sent to Mongo and run
> explain on them to verify my indexes. What's the best way to do this
> if I am using the Shapes or Query API?
val shapeQuery = AShape where {AShape.field is_== Const}
val query = shapeQuery.query
// returns com.osinka.mongodb.Query object, it contains the
// constraints (argument to find) and few DBCursor modifiers
// (e.g. sorting):
val dboQuery: DBObject = query.query
val skip: Option[Int] = query.skip
val limit: Option[Int] = query.limit
val sorting: Option[DBObject] = query.sorting
However, there is no way to extract DBCursor object. You could call explain() if it would be possible, but no way. You'll have to use mongo-java-driver:
val dboExplain = collection.find(dboObject).limit(l).skip(s).sort(dboSorting).explain()
> Thanks,
> Spike
>
>