score:1
Accepted answer
you can define a type alias just to shorten class names:
type dbo = mongodbobject
or in a similar way rename a class on import:
import com.mongodb.casbah.commons.{mongodbobject => dbo}
i don't like these solutions much. a better thing to do would be to use rogue. it not just reads better, it's actually much more typesafe. the only downside is that you have to define your db classes first before you can query, but once you do, your query would look like:
pages.where(_.id gt new objectid(pageid)).orderasc(_.id).limit(1)
or something like that :).
check here for more examples.
Source: stackoverflow.com
Related Query
- shortening MongoDBObject Conversion
- Implicit conversion vs. type class
- Scala: Elegant conversion of a string into a boolean
- Explicit Type Conversion in Scala
- How can I convert Scala Map to Java Map with scala.Float to java.Float k/v conversion
- Nashorn and Scala future to JS Promise conversion
- Could/should an implicit conversion from T to Option[T] be added/created in Scala?
- Scala char to int conversion
- Is it possible in Intellij IDEA Scala plugin to know which implicit conversion was applied?
- Date conversion
- Java <-> Scala interop: transparent List and Map conversion
- Conversion from scala parallel collection to regular collection
- Result type of an implicit conversion must be more specific than AnyRef
- Scala: Making implicit conversion A->B work for Option[A] -> Option[B]
- Is there a way to control which implicit conversion will be the default used?
- Implicit conversion to Runnable?
- Why this type of implicit conversion is illegal?
- Spark: Difference between collect(), take() and show() outputs after conversion toDF
- an expression of type Null is ineligible for implicit conversion
- Conversion of Scala map containing Boolean to Java map containing java.lang.Boolean
- generator/block to iterator/stream conversion
- Play 2.3 implicit json conversion causes null pointer exception
- Implicit conversion from String to Int in scala 2.8
- O(1) conversion from mutable.Map to immutable.Map?
- Scala implicit conversion from parent trait
- scala implicit or explicit conversion from iterator to iterable
- Implicit conversion from Int to Double in scala doesn't work
- Conversion from Seq to Set and back to Seq
- implicit conversion over multiple levels, why does int to double automatically work?
- Implicit conversion of java.util.List to scala List does not occur
More Query from same tag
- spark: Attempted to use Broadcast after it was destroyed
- How to initialize transient fields during deserialization?
- Accessing spark console from browser
- How to generate method or constructor parameter names against provided arguments in IntelliJ IDEA
- How to append an element to an Iterator in scala
- Extract multiple substrings from same string efficiently
- Replace Values in dataframe conditionally when key appears in a map
- Witness type derivation issue
- Pass map to slick filter and filter by the values in the map
- Check column datatype and execute SQL only on Integer and Decimal in Spark SQL
- Is it possible to extract the substream key in akkastreams?
- Getting reference to a parameter of the outer function having a conflicting name
- Best solution for version conflict in Spark program
- How to add an error flow for Akka http websockets
- Implicit resolution and companion objects for case classes
- scala constrain type of list objects by object property type
- Reading very large files (~ 1 TB) in sequential blocks
- how to sort Map[Int,Map[String,String]] according to inner map value
- scala observable unify observable with a sequence without intermediate datastructure update
- Why is adaptive SQL not working with df persist?
- Make function accept my Int-based value type
- mocking methods which use ClassTag in scala using scalamock
- How to transform a string column of a dataframe into a column of Array[String] with Apache Spark and Scala
- How to make tree mapping tail-recursive?
- Custom outputPath for sbt-assembly
- Accessing an Annotation Value in Scala
- Error with valid url using Source.fromUrl
- How to catch Execution exception in scala playframework?
- How do I mock static function (Object function, not class function) in scala
- implicit function that compares two closed classes in Scala