PlayMongoRepository

uk.gov.hmrc.mongo.play.json.PlayMongoRepository
class PlayMongoRepository[A](mongoComponent: MongoComponent, val collectionName: String, val domainFormat: Format[A], val indexes: Seq[IndexModel], val optSchema: Option[BsonDocument], replaceIndexes: Boolean, extraCodecs: Seq[Codec[_]])(implicit evidence$1: ClassTag[A], ec: ExecutionContext) extends MongoDatabaseCollection

Initialise a mongo repository.

Value parameters

collectionName

the name of the mongo collection.

domainFormat

a play Json format to map the domain to mongo entities.

extraCodecs

optional - to support more types

indexes

indexes to ensure are created.

optSchema

optional - to validate entities written to the collection

replaceIndexes

optional - default is false If true, existing indices should be removed/updated to match the provided indices. If false, any old indices are left behind, and indices with changed definitions will throw IndexConflict exceptions.

Attributes

Graph
Supertypes
trait MongoDatabaseCollection
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Concrete methods

def ensureIndexes(): Future[Seq[String]]
def ensureSchema(): Future[Unit]

Concrete fields

lazy val collection: MongoCollection[A]
final val collectionName: String
final val domainFormat: Format[A]
final val indexes: Seq[IndexModel]
lazy val initialised: Future[Unit]
final val optSchema: Option[BsonDocument]