diff options
Diffstat (limited to 'lib/opentox.rb')
-rw-r--r-- | lib/opentox.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb index b2e9c1b..9be6078 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -19,7 +19,7 @@ module OpenTox end def created_at - # TODO from BSON::ObjectId + @data["_id"].generation_time end # Object metadata (lazy loading) @@ -66,6 +66,11 @@ module OpenTox @data["_id"] = $mongo[collection].insert_one(@data).inserted_id end + # partial update + def update metadata + $mongo[collection].find(:_id => @data["_id"]).find_one_and_replace('$set' => metadata) + end + # Save object at webservice (replace or create object) def put #@data.delete("_id") # to enable updates |