Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added simple example.

  • Loading branch information...
commit be4b2984f0c63e1950583220d3901f1bafe77398 1 parent 24f3e4e
@jnunemaker authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 examples/read_write_delete.rb
View
18 examples/read_write_delete.rb
@@ -0,0 +1,18 @@
+$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
+require 'active_support/all'
+require 'bin'
+require 'pp'
+
+collection = Mongo::Connection.new.db('testing')['testing']
+collection.remove
+
+bin = Bin::Store.new(collection)
+bin.write('abc', 123)
+pp bin.read('abc')
+
+pp bin.read('def')
+pp bin.fetch('def') { 456 }
+pp bin.read('def')
+
+bin.delete('abc')
+bin.delete('def')
Please sign in to comment.
Something went wrong with that request. Please try again.