I use Spring Data - MongoDB 1.0.0.M3 and Spring 3.1.0.M2.
I wrote below class that has a
Code:public class Parent { private String id; private String message; private Object child; (getter and setter ...) }I tryed to insert into DB by using MongoTemplate.insert().Code:public class Child { private String id; private String name; }
Then I checked MongoDB by using MongoDB shell client as below
> db.parent.find()
I expected to get a value as follows.
But I got this.Code:{ "_id" : ObjectId("4e51f21cda549a6920d927d1"), "_class" : "org.sample.mongo.Parent", "child" : { "name" : "child name"}, "message" : "This is message" }
Why?Code:{ "_id" : ObjectId("4e51f21cda549a6920d927d1"), "_class" : "org.sample.mongo.Parent", "child" : {"_class" : "org.sample.mongo.Child"}, "message" : "This is message" }
How can I get collect result of child field ?(not "_class" but "name"!)


Reply With Quote
