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
3
votes
1 answer

Does salat support de/serialization of type Either in scala?

I have the following case classes: case class DataEntity ( name: String, value: Either[Complex, String] ) case class Complex (x: String, y: String) As far as I can see, serialization (writing to MongoDB) goes fine, but it fails in…
Mahdi
  • 1,778
  • 1
  • 21
  • 35
3
votes
1 answer

Casbah: No implicit view available error

In a Play app, using Salat and Casbah, I am trying to de-serialize a DBObject into an object of type Task, but I am getting this error when calling .asObject: No implicit view available from com.mongodb.casbah.Imports.DBObject => …
memoizr
  • 2,081
  • 2
  • 18
  • 24
3
votes
1 answer

Salat: How to debug stack trace to know what field in case class is causing exception

I am using Salat in my Scala / Scalatra project to serialize MongoDB objects. This is a general question in that I am trying to pull a complex MongoDB object from my database that embeds different hashes and arrays of its own that I have created…
randombits
  • 47,058
  • 76
  • 251
  • 433
3
votes
0 answers

Scala, Mongodb with casbah + salat. Atomic operation

I have the following DAO method: /** * Delete a Program (hard delete), or mark as deleted (soft delete) * will only hard-delete if: * * No other program is based on this one * * The program is not live */ def delete(id:…
nfvindaloo
  • 948
  • 2
  • 11
  • 24
3
votes
2 answers

Salat GRATER GLITCH ClassNotFoundException

I'm facing a strange issue with Salat and this happens especially when I run my Play web application. Here is the stacktrace: Caused by: java.util.concurrent.ExecutionException: Boxed Error at…
joesan
  • 13,963
  • 27
  • 95
  • 232
3
votes
2 answers

Howto test Custom Json Objects with Spray Routing

I'm creating a Rest API with spray-routing on top of mongodb for some CRUD operations, this all works fine, expect whenever I try to test it with specs2 the following specification class RestServiceSpec extends Specification with Specs2RouteTest…
Gertjan Assies
  • 1,890
  • 13
  • 23
3
votes
1 answer

Retrieve documents having array containing another document attribute

I am storing some kind of filesystem in Mongo, where directories are named categories. The category JSON looks like: { "name":"CategoryChildLevel2", "parentId":"2", "otherAttribute":"anyVal", "breadcrumb":[ { …
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
3
votes
1 answer

Any sample to store and retrieve image on mongodb using gridfs, scala and playframework2

I have a model case class Person( _id: ObjectId = new ObjectId, empno: String, name: String, picture: String ) I'm a bit lost on how do I handle the picture upload on the form, controller and view. Appreciate help for sample or point me to…
William
  • 395
  • 1
  • 5
  • 17
3
votes
3 answers

Still can't run multiple tests against play FakeApp with Salat / Casbah

I thought I had fixed the problem temporarily, but it turns out I am still having problems. I am trying to create some specs2 tests for my models layer, I would like to insert some dummy object, and then run some queries to make sure data comes out…
wfbarksdale
  • 7,498
  • 15
  • 65
  • 88
3
votes
2 answers

Play2, MongoDB, play-salat: class cast exceptions

I have an object Foo which contains a list of of objects Bar which I get from a MongoDb using play-salat plugin. The models look like this. case class Foo ( @Key("_id") id: ObjectId = new ObjectId, bars: Option[List[Bar]] = None ) case class…
schub
  • 912
  • 1
  • 8
  • 26
3
votes
4 answers

Can't Connect to MongoDB from play app with salat: command failed [listDatabases]

I am trying to get started with the salat plugin in playframework. I have configured the database in application.conf and added all the dependencies to Build.scala and added salat to the play.plugins file. I haven't actually added any code to the…
wfbarksdale
  • 7,498
  • 15
  • 65
  • 88
3
votes
2 answers

Play! Form that selects an item from a separate mongo collection

So for a system I am developing I am trying to do something similar to this: If I have a Model called User, that has an _id (ObjectId), username, password, and then I am trying to create a new appointment, my form would look for a patient (display…
3
votes
1 answer

Play! framework 2.0 scala - ClassCastException: models.MyModel cannot be cast to models.MyModel

This is my first play 2.0 app, and scala is still pretty new to me, so I'm likely making a mistake somewhere. I'm using a pretty new plugin that bundles Salat and Casbah: https://github.com/leon/play-salat I've simplified and renamed everything to…
Eve Freeman
  • 32,467
  • 4
  • 86
  • 101
2
votes
1 answer

How to read and write from MongoDb using two different drivers (MongoDB Scala Driver and Salat)

We want to change our MongoDB driver overtime to MongoDB Scala Driver, but we using Salat and it reads and writes sealed classes and ADTs using "_typeHint" to the DB. The MongoDB Scala Driver reads and writes sealed classes and ADTs using "_t", What…
Chester Cobus
  • 701
  • 4
  • 12
2
votes
1 answer

salat: GRATER GLITCH - ClassNotFoundException

I'm trying to make work a very simple example of Salat. build.sbt: libraryDependencies += "com.novus" %% "salat" % "1.9.9" In sbt console: import com.novus.salat._ import com.novus.salat.global._ import com.mongodb.casbah.Imports._ case class…
thomas legrand
  • 493
  • 1
  • 5
  • 16