I am the new bie for spring frame. I have my document in mongo, how
{ "_id" : ObjectId("527242d584ae917d8bd75c7b"), "postTitle" : "Car", "postDesc" : "rent", "owner" : ObjectId("526a588f84aed6f41cca10bd"), "intrest" : [] }
I want to search for document with id
"_id" : ObjectId("527242d584ae917d8bd75c7b")
and upgrade it to
{ "_id" : ObjectId("527242d584ae917d8bd75c7b"), "postTitle" : "Car", "postDesc" : "rent", "owner" : ObjectId("526a588f84aed6f41cca10bd"), "intrest" : [ { "userId" : ObjectId("526a587d84aed6f41cca10bc"), "timestamp" : ISODate("2013-10-31T11:45:25.256Z") }, { "userId" : ObjectId("526a587d84aed6f41cca10bc"), "timestamp" : ISODate("2013-11-31T11:55:25.256a") } ] }
my domain
@Document public class Post { @Id private ObjectId _id; private String postTitle; private String postDesc; private ObjectId owner=Global.getCurruser(); private List<Intrest> intrest = new ArrayList<Intrest>();
What you need to write to add or modify entries in the intrest [] array.
Please, help.
source share