I use Casbah and Salat to create my own Mongodba Dao and I implement the getAll method as follows:
val dao: SalatDAO[T, ObjectId] def getAll(): List[T] = dao.find(ref = MongoDBObject()).toList
What I want to know:
1 ° / The indicator ModelCompanionprovides methods def findAll(): SalatMongoCursor[ObjectType] = dao.find(MongoDBObject.empty). You will need to make a special request for each collection of your database.
ModelCompanion
def findAll(): SalatMongoCursor[ObjectType] = dao.find(MongoDBObject.empty)
, SalatMongoCursor[T], dao.find, ( toList from Iterator, List[T]).
SalatMongoCursor[T]
dao.find
toList
Iterator
List[T]
2 °/Salat _id id. id: ObjectId. mongo _id. , @Key, Salat
id: ObjectId
@Key
- :
MyDAO.ids(MongoDBObject("_id" -> MongoDBObject("$exists" -> true)))
, , , , , . , 5 , , MongoDB.
1 000 000 , ( getAll) . , , , .