mongo-ruby-driver/test/mongo-qa/gridfs_in

17 lines
308 B
Plaintext
Raw Normal View History

2009-02-18 22:43:22 +00:00
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
require 'mongo/gridfs'
include GridFS
2009-02-18 22:43:22 +00:00
db = Mongo::Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
2009-02-18 22:43:22 +00:00
input_file = ARGV[0]
File.open(input_file, "r") { |f|
GridStore.open(db, input_file, "w") { |g|
g.write(f.read)
}
}