Created
October 22, 2009 04:24
-
-
Save skippy/215726 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
Adam$ script/console | |
Loading development environment (Rails 2.3.4) | |
>> Mongo::VERSION | |
=> "0.15.1" | |
>> #MongoMapper::VERSION == 0.5.5 | |
?> document = Class.new do | |
?> include MongoMapper::Document | |
>> set_collection_name 'duplicate_id_test' | |
>> | |
?> key :data, String | |
>> end | |
=> #<Class:0x10340c9b0> | |
>> document.collection.clear | |
=> #<TCPSocket:0x1033c3670> | |
>> | |
?> doc = document.new :data => 'howdy do!' | |
=> #<#<Class:0x10340c9b0> data: "howdy do!", _id: nil> | |
>> doc.save | |
=> true | |
>> doc.inspect | |
=> "#<#<Class:0x10340c9b0> data: "howdy do!", _id: 4adfddf80a0aec3028000001>" | |
#FROM mongo console | |
> db.duplicate_id_test.count() | |
1 | |
> db.duplicate_id_test.findOne() | |
{ | |
"_id" : ObjectId("4adfddf80a0aec3028000001"), | |
"_id" : ObjectId("4adfddf80a0aec3028000001"), | |
"data" : "howdy do!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment