All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jeroenr.tepkin.protocol.result.DistinctResult.scala Maven / Gradle / Ivy

package com.github.jeroenr.tepkin.protocol.result

import com.github.jeroenr.bson.Implicits.BsonValueArray
import com.github.jeroenr.bson.{BsonDocument, BsonValue, BsonValueNumber, Implicits}

case class DistinctResult(ok: Boolean,
                          values: Seq[BsonValue],
                          stats: BsonDocument) extends Result

object DistinctResult {
  def apply(document: BsonDocument): DistinctResult = {
    DistinctResult(
      ok = document.get[BsonValueNumber]("ok").get.toInt == 1,
      values = document.get[BsonValueArray]("values").get.identifier.elements.map(_.value),
      stats = document.getAs[BsonDocument]("stats").get)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy