mince 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,10 @@ module Mince
15
15
  BSON::ObjectId.new.to_s
16
16
  end
17
17
 
18
+ def delete_field(collection_name, key)
19
+ collection(collection_name).update({}, {"$unset" => { key => 1 } }, multi: true)
20
+ end
21
+
18
22
  def add(collection_name, hash)
19
23
  collection(collection_name).insert(hash)
20
24
  end
data/lib/mince/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mince
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -26,6 +26,13 @@ describe Mince::DataStore do
26
26
  described_class.primary_key_identifier.should == '_id'
27
27
  end
28
28
 
29
+ it 'can delete a field' do
30
+ field = mock 'field to delete'
31
+ collection.should_receive(:update).with({}, {'$unset' => { field => 1 } }, multi: true)
32
+
33
+ subject.delete_field(collection_name, field)
34
+ end
35
+
29
36
  describe "Generating a primary key" do
30
37
  let(:unique_id) { mock 'id' }
31
38
  it 'should create a reasonably unique id' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mince
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-05-21 00:00:00.000000000 Z
14
+ date: 2012-05-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport