I'm trying to insert into a MongoDB collection.
I have a data model containing an Id (ObjectId) and a Timestamp (long)
as the first two properties.
From here (
http://www.mongodb.org/display/DOCS/Timestamp+data+type -
second para), i understand that if these are both null, they should
get automatically populated?
When Saving the entity, the ObjectId (Id/_id) column is being set,
although the timestamp remains null. Is there something special i need
to do set set this?
I've tried:
newdoc= Update.Replace(doc.ToBsonDocument().Set("Timestamp", new
BsonJavaScript("new Timestamp()")));
db.mydocs.Save(newdoc);
But then get "GetDocumentId method cannot be called on a
UpdateWrapper." exception.
Can anybody point me in right direction?
Thanks in advance
Sam