Created
October 22, 2009 17:52
-
-
Save banker/216132 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using mongo-0.15.1 with mongo_ext-0.15.1 | |
require 'rubygems' | |
require 'mongo' | |
db = Mongo::Connection.new('localhost', 27017).db('stuff') | |
coll = db['stuff'] | |
coll.remove | |
coll.save({"_id" => "4ae06a7662125b1b72000001", 'name' => "first doc"}) | |
coll.save({'_id' => '4ae06a7662125b1dsf000002', 'name' => "second doc"}) | |
coll.save({'name' => "doc without id"}) | |
------ | |
Results: | |
> db.stuff.find() | |
{ "_id" : "4ae06a7662125b1b72000001", "name" : "first doc" } | |
{ "_id" : "4ae06a7662125b1dsf000002", "name" : "second doc" } | |
{ "_id" : ObjectId("4ae09bae62125b2410000001"), "name" : "doc without id" } | |
Same behavior without mongo_ext. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment