-
Notifications
You must be signed in to change notification settings - Fork 106
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
Case class not serialising in order #208
Comments
Are you using salat for serialization into mongo, or for generating JSON from case classes? In either case, I'm not aware of a guarantee that order of field declaration is preserved. Might I ask what problem this is causing for you? |
We are using salat for serialization of a case class which is used as a compound key for inserting document into a Mongo collection. |
This is somewhat related to #110 Field order preservation has not been a guarantee of Salat, and to be fair it seems that at the time Salat was first written Mongo itself did not support it. Salat itself does not rely on ordinal fields in the BSON serialized form, as it uses field names to map values from the DBObject to the case class. You are welcome to dig around in Mongo source and propose a fix. I suggest that the |
I have a case class
case class A(a: Int, b: Int)
I m seeing sometimes that the resulting serialized value is
{a:1,b:1}
and sometimes{b:1,a:1}
Does salat provide any guarantees as to the order of serialization in a case class? Can this be done?
The text was updated successfully, but these errors were encountered: