-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem inserting nested Document type #19
Comments
This is a newly introduced bug, as all of my nested inserts no longer work. |
Can u give me an example of your case class declaration so I can make a test On October 1, 2014 9:46:53 PM CDT, Michael notifications@github.com wrote:
|
case class Address(labels: List[String] = List("sample")) extends Document
case class User(name: String, active: Boolean = true, address: Address = Address(), id: Option[String] = None) extends Document |
Fixed in 0.4.5. Sorry for the delay |
Thanks worked great. |
Please reopen. I had to switching back to using: |
I'll check this one today On February 1, 2015 4:16:46 AM CST, Michael notifications@github.com wrote:
|
Can't you provide a example of your document. Here is my current test and it seems to be passing: case class NestedAddress(labels: List[String]) extends Document
case class NestedUser(name: String, active: Boolean , address: NestedAddress, id: Option[String] = None) extends Document
class NestedTest extends FunSuite with WithBase {
test("nested documents") {
val user = NestedUser("foo",true,NestedAddress(List("hello")))
val foos= r.tableAs[NestedUser]("foo")
val term = foos.insert(user)
val query = version3.toQuery(term, 1, None, Map.empty)
val json = query.json
println(json)
val answer =for {
res <- term.toOpt
user2 <- foos.get(res.generatedKeys.head).toOpt
} yield user2
println(answer)
// Some(NestedUser(foo,true,NestedAddress(List(hello)),Some(d0189ff4-70fa-46c0-bc6a-cee5450a5b64)))
}
}``` |
Tested a few more nested case class NestedZip(zip:String) extends Document
case class NestedStreet(zip:NestedZip) extends Document
case class NestedAddress(street:NestedStreet) extends Document
case class NestedUser(name: String, active: Boolean , address: NestedAddress, id: Option[String] = None) extends Document I would double check that all case classes extend |
I see the difference. My user case class includes an object that doesn't inherit from Document as it is from an imported class and is inserting null value for that field. However, this was not always the case, 0.4.4 allows me to insert this object with no problem. Let me know if you need me to provide further examples. |
user is of type User extends Document and includes another type extending Document.
Fails:
Client is buggy (failed to deserialize query).
Works:
The text was updated successfully, but these errors were encountered: