Merge: mongodb: auto generate ObjectId for inserted and saved documents
authorJean Privat <jean@pryen.org>
Tue, 30 Jun 2015 00:48:48 +0000 (20:48 -0400)
committerJean Privat <jean@pryen.org>
Tue, 30 Jun 2015 00:48:48 +0000 (20:48 -0400)
This PR enables the generation of unique ObjectIds for new JsonObject added to collection.

Example when inserting a document:
~~~nit
var obj = new JsonObject
obj["foo"] = "bar"
print obj.to_json
~~~

Object before insertion:
~~~json
{
   "foo": "bar"
}
~~~

After insertion:
~~~nit
collection.insert(obj)
print obj.to_json
~~~
~~~json
{
   "_id": {"$oid": "5578e5e5f34422650c27af01"},
   "foo": "bar"
}
~~~

Pull-Request: #1500
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>


Trivial merge