Questions tagged [salat]

Salat is a bi-directional Scala case class serialization library that leverages MongoDB's `DBObject` (which uses BSON underneath) as its target format.

The Salat project focuses on speed and simplicity of serializing case classes to and from target formats.

Salat is not a fully-fledged ORM and does not attempt to match the flexibility, compability or functionality of an ORM that would let you define relationships between classes, provide a query language, or serialize/deserialize every collection type known to Java or Scala.

109 questions
2
votes
1 answer

Ensuring indexes with MongoDB using Salat DAOs

There is a post on composite keys using Salat, but information on ensuring indexes (from mongo-db console, db.collection.ensureIndex({someField : 1})) is lacking. Looking through Salat source, I didn't see an annotation for marking a field as…
DK_
  • 2,648
  • 2
  • 21
  • 20
2
votes
1 answer

Scala Play Salat Aggregate Example

I am using Scala Play 2.x with MongoDB in backend and I must confess that Salat has wonderful support for mongo CRUD operations. But so far I didn't find any good example of how I can call mongo aggregate function using SALAT like $unwind, $match,…
vikashait
  • 499
  • 4
  • 10
2
votes
1 answer

Single serialization layer to Json with Casbah/Salat

I am trying to create a serialization layer which allows me to: Store my classes in a MongoDB data source Convert them to JSON to use them in a REST API. Some classes are clearly not case classes (because they are inherited from a Java codebase)…
Edmondo
  • 19,559
  • 13
  • 62
  • 115
2
votes
1 answer

Exception while retrieving Salat Object with Subclass

I have an object with has an subclass as attribute: case class UpgradeInfo( @EnumAs upgradeType: UpgradeType.Value, @EnumAs timeUnit: TimeUnit.Value, timeQuantity: Int, start: Date, end: Date) case class Upgrade( @Key("_id")…
pichsenmeister
  • 2,132
  • 4
  • 18
  • 34
2
votes
1 answer

Salat Fails to Serialize in Running Play Framework Application but Works Fine in Console

I have a Play 2.1.0 (Scala) framework application and I am trying to use Salat to convert my case class objects into MongoDBObjects. When I fire up the play console, instantiate one of my case classes, import salat._ and salat.global._ I am able to…
Kevin Hoffman
  • 5,154
  • 4
  • 31
  • 33
2
votes
1 answer

Play2 + Casbah: How to provide an implicit Writes for ObjectId

there is a simple model class that contains some database ids. It looks like this: case class Post(id: ObjectId, owner: Option[ObjectId], title: String) object Post { implicit val implicitPostWrites = Json.writes[Post] } With this code, the…
schub
  • 912
  • 1
  • 8
  • 26
2
votes
1 answer

How to convert JSON into Scala class (NOT Case class), and then populate set of case classes from that big class

I am building an application using Scala 2.10, Salat and Play frmework 2.1-RC2 (will upgrade to 2.1 release soon) and MongoDB. This is a faceless application where JSON web services are exposed for consumers. Up until now JSON was converted into…
user2066049
  • 1,371
  • 1
  • 12
  • 26
2
votes
2 answers

Build.scala: specify scala version does not work

I use playframework and here is my appDependencies in Build.scala: val appDependencies = Seq( // Add your project dependencies here, jdbc, anorm, "com.rabbitmq" % "amqp-client" % "3.0.1", "com.typesafe.akka" %% "akka-agent" %…
Vadim Samokhin
  • 3,378
  • 4
  • 40
  • 68
2
votes
1 answer

MongoDB query does not find documents in collection

My query does not find documents in my MongoDB collection This is example object in the database (notice that position.x and position.y are Longs in Salat) { "_id": ObjectId("50e85039e4b0f225b98b8b34"), "worldSlug": "test", "position": { …
Mateusz
  • 498
  • 4
  • 17
2
votes
1 answer

Mapping Java beans and Scala case classes to MongoDB objects

I am currently struggling with this issue here.. In our system, we use Java beans and Scala case classes, and they often contains one another. So, i am looking for a good solution for how to map these objects to mongoObjects, so i can save/load them…
Nadav Leshem
  • 193
  • 9
2
votes
2 answers

NoClassDefFoundError => ClassPath$JavaContext when using play start

I've made a little Scala, Play2.0.2 application. It works fine when i use play run command, but when i use play start or play clean compile stage + target/start, when trying to do a MongoDB insertion with Casbah/Salat, i get the following…
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
1
vote
1 answer

Salat Error: class file needed by SalatDAO is missing. reference type MongoCollection of com.mongodb.casbah.TypeImports refers to nonexisting symbol

I'm getting the following error when I try to extend SalatDAO or use grater[T].asObject(x): class file needed by SalatDAO is missing. reference type MongoCollection of com.mongodb.casbah.TypeImports refers to nonexisting symbol. I've followed…
fin
  • 39
  • 5
1
vote
1 answer

salat serialize Map[Enum,Boolean] type

Hi I would like to serialize/deserealise to DBObject some map with enumeration as key using salat. object MyEnum extends Enumeration { val VAL_ONE, VAL_TWO = Value } case class CanBeStored(a:Enumeration.Value) case class…
Oleg
  • 3,080
  • 3
  • 40
  • 51
1
vote
1 answer

Problems with Salat methods in MongoDB: implicit view & not enough arguments

I'm new with Salat,Casbah and MongoDB. When I've been trying to make a simple method to get all users from db, import DAL.Instances.User.{UserDAO, User} import com.novus.salat._ import com.novus.salat.global._ import…
NikitaAbrosimov
  • 127
  • 1
  • 8
1
vote
1 answer

How to write MongoDBObject and case class for group by

I am new to mongo, scala and salat I have json collection as {[ {"firstName":"John", "lastName":"Doe", department="IT", skills="java"}, {"firstName":"Anna", "lastName":"Smith", department="accounts, skills="tally"}, …
Sanjay Rabari
  • 2,091
  • 1
  • 17
  • 32