@Embedded objects in NoSQL/Mongo are persisted inside array containers [message #1122454] |
Tue, 01 October 2013 15:41 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Jay Roberts![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=pudakai%40gmail.com) Messages: 2 Registered: April 2013 |
Junior Member |
|
|
We are getting a result (this is conceptual code):
@Embeddable
class Address{
String street;
}
@Entity
class Person{
@Field
String name;
@Field
@Embedded
Address address
}
When we persist a Person, the Mongo object/JSON has the embedded Person wrapped in an Array, a Person instance in Mongo looks like
{
"name" : "John",
"address": [{"street": "Elm Street"}]
}
We don't want this extraneous array, any way to prevent this? We need it gone for backwards data compatibility. I.e, we want it to look like:
{
"name" : "John",
"address": {"street": "Elm Street"}
}
Thanks to anyone who has any advice on this!
Jay Roberts
[Updated on: Wed, 02 October 2013 12:31] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04782 seconds