Embedded JSON Objects not saved in BsonRecordListField using fromJSON

i'm using lift-mongodb-record 2.4 to manage MongoRecords for a RESTful JSON Webservice. Everything works really good, except one issue i ran into: Embedded BsonRecordListFields are not saved automatically.

This is my test-JSON:


But printing the model through println(Artifact.fromJSON(request.body).get) will only print

class com.test.model.Artifact={name=test, control_points=}

these are my model classes:

class ControlPoint private () extends BsonRecord[ControlPoint] {
  def meta = ControlPoint
  object dx extends DoubleField(this)
  object dy extends DoubleField(this)

object ControlPoint extends ControlPoint with BsonMetaRecord[ControlPoint]

class Artifact private () extends MongoRecord[Artifact] with ObjectIdPk[Artifact] {
  def meta = Artifact
  object name extends StringField(this, 1024)
  object control_points extends BsonRecordListField(this,ControlPoint)
object Artifact extends Artifact with MongoMetaRecord[Artifact] {}

why is the embedded stuff not saved? do I miss anything here?

thanks a lot! Martin


As pointed out on the lift mailing list lift-json parses the number as ints because they don't have a decimal point. I just changed the fields to IntField and parsed all date to Integers through parseInt on client-side.

Need Your Help

php stop user from viewing logs

php logging

<form method = "post" action = "<?php echo $_SERVER['PHP_SELF']; ?>" />

Randomly Assign Integers in R within groups without replacement

r integer sampling experimental-design

I am running an experiment with two experiments: experiment_1 and experiment_2. Each experiment has 5 different treatments (i.e. 1, 2, 3, 4, 5). We are trying to randomly assign the treatments wit...