Last active
August 29, 2015 14:19
-
-
Save MatthewRDodds/b6f7dbc01b4b23d87565 to your computer and use it in GitHub Desktop.
Ruby Converting From String to BSON::ObjectId and From BSON::ObjectId to String
This file contains hidden or 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
pry(main)> id | |
=> BSON::ObjectId('5537c5a93338660008010000') | |
pry(main)> id.to_s # Converting to string | |
=> "5537c5a93338660008010000" | |
pry(main)> BSON::ObjectId.from_string id.to_s # Converting from String | |
=> BSON::ObjectId('5537c5a93338660008010000') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment