mince_mongo_db 1.0.0.pre.1 → 1.0.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mince_mongo_db/config.rb +43 -0
- data/lib/mince_mongo_db/connection.rb +32 -0
- data/lib/mince_mongo_db/data_store.rb +26 -0
- data/lib/mince_mongo_db/interface.rb +112 -0
- data/lib/mince_mongo_db/version.rb +19 -0
- data/lib/mince_mongo_db.rb +7 -0
- data/spec/integration/mince_interface_spec.rb +2 -2
- data/spec/units/{mongo_db → mince_mongo_db}/config_spec.rb +2 -2
- data/spec/units/{mongo_db → mince_mongo_db}/connection_spec.rb +3 -3
- data/spec/units/{mongo_db → mince_mongo_db}/data_store_spec.rb +2 -2
- data/spec/units/{mongo_db → mince_mongo_db}/interface_spec.rb +6 -6
- metadata +17 -17
- data/lib/mongo_db/config.rb +0 -45
- data/lib/mongo_db/connection.rb +0 -34
- data/lib/mongo_db/data_store.rb +0 -28
- data/lib/mongo_db/interface.rb +0 -114
- data/lib/mongo_db/version.rb +0 -21
- data/lib/mongo_db.rb +0 -9
@@ -0,0 +1,43 @@
|
|
1
|
+
module MinceMongoDb # :nodoc:
|
2
|
+
require 'singleton'
|
3
|
+
|
4
|
+
# = Config
|
5
|
+
#
|
6
|
+
# Config specifies the configuration settings
|
7
|
+
#
|
8
|
+
# @author Matt Simpson
|
9
|
+
class Config
|
10
|
+
include Singleton
|
11
|
+
|
12
|
+
# Returns the primary key identifier for records. This is necessary because not all databases use the same
|
13
|
+
# primary key.
|
14
|
+
#
|
15
|
+
# @return [Symbol] the name of the primary key field.
|
16
|
+
def self.primary_key
|
17
|
+
instance.primary_key
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.database_name
|
21
|
+
instance.database_name
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.database_name=(val)
|
25
|
+
instance.database_name = val
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.test_env_number
|
29
|
+
ENV['TEST_ENV_NUMBER']
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_accessor :primary_key, :database_name
|
33
|
+
|
34
|
+
def initialize
|
35
|
+
self.primary_key = :_id
|
36
|
+
self.database_name = 'mince'
|
37
|
+
end
|
38
|
+
|
39
|
+
def database_name=(name)
|
40
|
+
@database_name = [name, self.class.test_env_number].compact.join("-")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module MinceMongoDb
|
2
|
+
require_relative 'config'
|
3
|
+
require 'mongo'
|
4
|
+
require 'singleton'
|
5
|
+
|
6
|
+
class Connection
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
attr_accessor :connection, :db
|
10
|
+
|
11
|
+
def self.connection
|
12
|
+
instance.connection
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.db
|
16
|
+
instance.db
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
self.connection = Mongo::Connection.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def connection=(con)
|
24
|
+
@connection = con
|
25
|
+
self.db = connection.db(database_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
def database_name
|
29
|
+
Config.database_name
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module MinceMongoDb
|
2
|
+
require 'singleton'
|
3
|
+
require_relative 'connection'
|
4
|
+
|
5
|
+
class DataStore
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
def self.collection(collection_name)
|
9
|
+
instance.collection(collection_name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.db
|
13
|
+
instance.db
|
14
|
+
end
|
15
|
+
|
16
|
+
def collection(collection_name)
|
17
|
+
db.collection(collection_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_accessor :db
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
self.db = Connection.db
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
module MinceMongoDb
|
2
|
+
module Interface
|
3
|
+
require_relative 'data_store'
|
4
|
+
require_relative 'config'
|
5
|
+
|
6
|
+
def self.generate_unique_id(*args)
|
7
|
+
BSON::ObjectId.new.to_s
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.primary_key
|
11
|
+
Config.primary_key
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.delete_field(collection_name, key)
|
15
|
+
collection(collection_name).update({}, {"$unset" => { key => 1 } }, multi: true)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.delete_by_params(collection_name, params)
|
19
|
+
collection(collection_name).remove(params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.add(collection_name, hash)
|
23
|
+
collection(collection_name).insert(hash)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.replace(collection_name, hash)
|
27
|
+
collection(collection_name).update({primary_key => hash[primary_key]}, hash)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.update_field_with_value(collection_name, primary_key_value, field_name, new_value)
|
31
|
+
collection(collection_name).update({primary_key => primary_key_value}, {'$set' => { field_name => new_value } })
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.increment_field_by_amount(collection_name, primary_key_value, field_name, amount)
|
35
|
+
collection(collection_name).update({primary_key => primary_key_value}, {'$inc' => { field_name => amount } })
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.get_all_for_key_with_value(collection_name, key, value)
|
39
|
+
get_by_params(collection_name, key.to_s => value)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.get_for_key_with_value(collection_name, key, value)
|
43
|
+
get_all_for_key_with_value(collection_name, key, value).first
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.get_by_params(collection_name, hash)
|
47
|
+
collection(collection_name).find(hash)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.find_all(collection_name)
|
51
|
+
collection(collection_name).find
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.find(collection_name, key, value)
|
55
|
+
collection(collection_name).find_one({key.to_s => value})
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.push_to_array(collection_name, identifying_key, identifying_value, array_key, value_to_push)
|
59
|
+
collection(collection_name).update({identifying_key.to_s => identifying_value}, {'$push' => {array_key.to_s => value_to_push}})
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.remove_from_array(collection_name, identifying_key, identifying_value, array_key, value_to_remove)
|
63
|
+
collection(collection_name).update({identifying_key.to_s => identifying_value}, {'$pull' => {array_key.to_s => value_to_remove}})
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.containing_any(collection_name, key, values)
|
67
|
+
collection(collection_name).find({key.to_s => {"$in" => values}})
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.array_contains(collection_name, key, value)
|
71
|
+
collection(collection_name).find(key.to_s => value)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.clear
|
75
|
+
db.collection_names.each do |collection_name|
|
76
|
+
db.drop_collection collection_name unless collection_name.include?('system')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.delete_collection(collection_name)
|
81
|
+
collection(collection_name).drop
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.insert(collection_name, data)
|
85
|
+
data.each do |datum|
|
86
|
+
add collection_name, datum
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.set_data(data)
|
91
|
+
clear
|
92
|
+
|
93
|
+
data.each do |key, value|
|
94
|
+
insert key, value
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.data
|
99
|
+
db.collection_names.map do |collection_name|
|
100
|
+
find_all collection_name
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.collection(collection_name)
|
105
|
+
DataStore.collection(collection_name)
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.db
|
109
|
+
DataStore.db
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require_relative '../../lib/
|
1
|
+
require_relative '../../lib/mince_mongo_db'
|
2
2
|
require 'mince/shared_examples/interface_example'
|
3
3
|
|
4
4
|
describe 'Mince Interface with MongoDb' do
|
5
5
|
before do
|
6
|
-
Mince::Config.interface =
|
6
|
+
Mince::Config.interface = MinceMongoDb::Interface
|
7
7
|
end
|
8
8
|
|
9
9
|
it_behaves_like 'a mince interface'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative '../../../lib/
|
1
|
+
require_relative '../../../lib/mince_mongo_db/config'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe MinceMongoDb::Config do
|
4
4
|
it 'contains the primary key to used by the db interface' do
|
5
5
|
described_class.primary_key.should == :_id
|
6
6
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative '../../../lib/
|
1
|
+
require_relative '../../../lib/mince_mongo_db/connection'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe MinceMongoDb::Connection do
|
4
4
|
subject { described_class.instance }
|
5
5
|
|
6
6
|
let(:mongo_connection) { mock 'a mongo connection object', :db => db }
|
@@ -8,7 +8,7 @@ describe Mince::MongoDb::Connection do
|
|
8
8
|
let(:database_name) { mock }
|
9
9
|
|
10
10
|
before do
|
11
|
-
|
11
|
+
MinceMongoDb::Config.stub(database_name: database_name)
|
12
12
|
subject.connection = mongo_connection
|
13
13
|
end
|
14
14
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative '../../../lib/
|
1
|
+
require_relative '../../../lib/mince_mongo_db/data_store'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe MinceMongoDb::DataStore do
|
4
4
|
let(:db) { mock }
|
5
5
|
let(:collection) { mock }
|
6
6
|
let(:collection_name) { mock }
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require_relative '../../../lib/
|
1
|
+
require_relative '../../../lib/mince_mongo_db/interface'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe MinceMongoDb::Interface do
|
4
4
|
|
5
5
|
let(:interface) { described_class }
|
6
|
-
let(:primary_key) {
|
6
|
+
let(:primary_key) { MinceMongoDb::Config.primary_key }
|
7
7
|
|
8
8
|
let(:db) { mock 'mongo database' }
|
9
9
|
let(:mongo_data_store_connection) { mock 'mongo_data_store_connection', :db => db}
|
@@ -15,9 +15,9 @@ describe Mince::MongoDb::Interface do
|
|
15
15
|
let(:return_data) { mock 'return data' }
|
16
16
|
|
17
17
|
before do
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
MinceMongoDb::DataStore.stub(:db).and_return(db)
|
19
|
+
MinceMongoDb::DataStore.stub(:collection).with(collection_name).and_return(collection)
|
20
|
+
MinceMongoDb::Config.stub(primary_key: primary_key)
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'uses the correct collection' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mince_mongo_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.2
|
5
5
|
prerelease: 6
|
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-11-
|
14
|
+
date: 2012-11-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: mongo
|
@@ -197,17 +197,17 @@ executables: []
|
|
197
197
|
extensions: []
|
198
198
|
extra_rdoc_files: []
|
199
199
|
files:
|
200
|
-
- lib/
|
201
|
-
- lib/
|
202
|
-
- lib/
|
203
|
-
- lib/
|
204
|
-
- lib/
|
205
|
-
- lib/
|
200
|
+
- lib/mince_mongo_db.rb
|
201
|
+
- lib/mince_mongo_db/config.rb
|
202
|
+
- lib/mince_mongo_db/connection.rb
|
203
|
+
- lib/mince_mongo_db/data_store.rb
|
204
|
+
- lib/mince_mongo_db/interface.rb
|
205
|
+
- lib/mince_mongo_db/version.rb
|
206
206
|
- spec/integration/mince_interface_spec.rb
|
207
|
-
- spec/units/
|
208
|
-
- spec/units/
|
209
|
-
- spec/units/
|
210
|
-
- spec/units/
|
207
|
+
- spec/units/mince_mongo_db/config_spec.rb
|
208
|
+
- spec/units/mince_mongo_db/connection_spec.rb
|
209
|
+
- spec/units/mince_mongo_db/data_store_spec.rb
|
210
|
+
- spec/units/mince_mongo_db/interface_spec.rb
|
211
211
|
homepage: https://github.com/coffeencoke/mince_mongo_db
|
212
212
|
licenses: []
|
213
213
|
post_install_message:
|
@@ -222,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
222
|
version: '0'
|
223
223
|
segments:
|
224
224
|
- 0
|
225
|
-
hash:
|
225
|
+
hash: -3411619680046133823
|
226
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
227
|
none: false
|
228
228
|
requirements:
|
@@ -237,8 +237,8 @@ specification_version: 3
|
|
237
237
|
summary: Lightweight MongoDB ORM for Ruby.
|
238
238
|
test_files:
|
239
239
|
- spec/integration/mince_interface_spec.rb
|
240
|
-
- spec/units/
|
241
|
-
- spec/units/
|
242
|
-
- spec/units/
|
243
|
-
- spec/units/
|
240
|
+
- spec/units/mince_mongo_db/config_spec.rb
|
241
|
+
- spec/units/mince_mongo_db/connection_spec.rb
|
242
|
+
- spec/units/mince_mongo_db/data_store_spec.rb
|
243
|
+
- spec/units/mince_mongo_db/interface_spec.rb
|
244
244
|
has_rdoc:
|
data/lib/mongo_db/config.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
module Mince # :nodoc:
|
2
|
-
module MongoDb # :nodoc:
|
3
|
-
require 'singleton'
|
4
|
-
|
5
|
-
# = Config
|
6
|
-
#
|
7
|
-
# Config specifies the configuration settings
|
8
|
-
#
|
9
|
-
# @author Matt Simpson
|
10
|
-
class Config
|
11
|
-
include Singleton
|
12
|
-
|
13
|
-
# Returns the primary key identifier for records. This is necessary because not all databases use the same
|
14
|
-
# primary key.
|
15
|
-
#
|
16
|
-
# @return [Symbol] the name of the primary key field.
|
17
|
-
def self.primary_key
|
18
|
-
instance.primary_key
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.database_name
|
22
|
-
instance.database_name
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.database_name=(val)
|
26
|
-
instance.database_name = val
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.test_env_number
|
30
|
-
ENV['TEST_ENV_NUMBER']
|
31
|
-
end
|
32
|
-
|
33
|
-
attr_accessor :primary_key, :database_name
|
34
|
-
|
35
|
-
def initialize
|
36
|
-
self.primary_key = :_id
|
37
|
-
self.database_name = 'mince'
|
38
|
-
end
|
39
|
-
|
40
|
-
def database_name=(name)
|
41
|
-
@database_name = [name, self.class.test_env_number].compact.join("-")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/mongo_db/connection.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
module Mince
|
2
|
-
module MongoDb
|
3
|
-
require_relative 'config'
|
4
|
-
require 'mongo'
|
5
|
-
require 'singleton'
|
6
|
-
|
7
|
-
class Connection
|
8
|
-
include Singleton
|
9
|
-
|
10
|
-
attr_accessor :connection, :db
|
11
|
-
|
12
|
-
def self.connection
|
13
|
-
instance.connection
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.db
|
17
|
-
instance.db
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize
|
21
|
-
self.connection = Mongo::Connection.new
|
22
|
-
end
|
23
|
-
|
24
|
-
def connection=(con)
|
25
|
-
@connection = con
|
26
|
-
self.db = connection.db(database_name)
|
27
|
-
end
|
28
|
-
|
29
|
-
def database_name
|
30
|
-
Config.database_name
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/lib/mongo_db/data_store.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
module Mince
|
2
|
-
module MongoDb
|
3
|
-
require 'singleton'
|
4
|
-
require_relative 'connection'
|
5
|
-
|
6
|
-
class DataStore
|
7
|
-
include Singleton
|
8
|
-
|
9
|
-
def self.collection(collection_name)
|
10
|
-
instance.collection(collection_name)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.db
|
14
|
-
instance.db
|
15
|
-
end
|
16
|
-
|
17
|
-
def collection(collection_name)
|
18
|
-
db.collection(collection_name)
|
19
|
-
end
|
20
|
-
|
21
|
-
attr_accessor :db
|
22
|
-
|
23
|
-
def initialize
|
24
|
-
self.db = Mince::MongoDb::Connection.db
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/mongo_db/interface.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
module Mince
|
2
|
-
module MongoDb
|
3
|
-
module Interface
|
4
|
-
require_relative 'data_store'
|
5
|
-
require_relative 'config'
|
6
|
-
|
7
|
-
def self.generate_unique_id(*args)
|
8
|
-
BSON::ObjectId.new.to_s
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.primary_key
|
12
|
-
Config.primary_key
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.delete_field(collection_name, key)
|
16
|
-
collection(collection_name).update({}, {"$unset" => { key => 1 } }, multi: true)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.delete_by_params(collection_name, params)
|
20
|
-
collection(collection_name).remove(params)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.add(collection_name, hash)
|
24
|
-
collection(collection_name).insert(hash)
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.replace(collection_name, hash)
|
28
|
-
collection(collection_name).update({primary_key => hash[primary_key]}, hash)
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.update_field_with_value(collection_name, primary_key_value, field_name, new_value)
|
32
|
-
collection(collection_name).update({primary_key => primary_key_value}, {'$set' => { field_name => new_value } })
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.increment_field_by_amount(collection_name, primary_key_value, field_name, amount)
|
36
|
-
collection(collection_name).update({primary_key => primary_key_value}, {'$inc' => { field_name => amount } })
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.get_all_for_key_with_value(collection_name, key, value)
|
40
|
-
get_by_params(collection_name, key.to_s => value)
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.get_for_key_with_value(collection_name, key, value)
|
44
|
-
get_all_for_key_with_value(collection_name, key, value).first
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.get_by_params(collection_name, hash)
|
48
|
-
collection(collection_name).find(hash)
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.find_all(collection_name)
|
52
|
-
collection(collection_name).find
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.find(collection_name, key, value)
|
56
|
-
collection(collection_name).find_one({key.to_s => value})
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.push_to_array(collection_name, identifying_key, identifying_value, array_key, value_to_push)
|
60
|
-
collection(collection_name).update({identifying_key.to_s => identifying_value}, {'$push' => {array_key.to_s => value_to_push}})
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.remove_from_array(collection_name, identifying_key, identifying_value, array_key, value_to_remove)
|
64
|
-
collection(collection_name).update({identifying_key.to_s => identifying_value}, {'$pull' => {array_key.to_s => value_to_remove}})
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.containing_any(collection_name, key, values)
|
68
|
-
collection(collection_name).find({key.to_s => {"$in" => values}})
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.array_contains(collection_name, key, value)
|
72
|
-
collection(collection_name).find(key.to_s => value)
|
73
|
-
end
|
74
|
-
|
75
|
-
def self.clear
|
76
|
-
db.collection_names.each do |collection_name|
|
77
|
-
db.drop_collection collection_name unless collection_name.include?('system')
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def self.delete_collection(collection_name)
|
82
|
-
collection(collection_name).drop
|
83
|
-
end
|
84
|
-
|
85
|
-
def self.insert(collection_name, data)
|
86
|
-
data.each do |datum|
|
87
|
-
add collection_name, datum
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.set_data(data)
|
92
|
-
clear
|
93
|
-
|
94
|
-
data.each do |key, value|
|
95
|
-
insert key, value
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.data
|
100
|
-
db.collection_names.map do |collection_name|
|
101
|
-
find_all collection_name
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def self.collection(collection_name)
|
106
|
-
DataStore.collection(collection_name)
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.db
|
110
|
-
DataStore.db
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
data/lib/mongo_db/version.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Mince
|
2
|
-
module MongoDb
|
3
|
-
module Version
|
4
|
-
def self.major
|
5
|
-
1
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.minor
|
9
|
-
0
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.patch
|
13
|
-
"0.pre.1"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.version
|
18
|
-
[Version.major, Version.minor, Version.patch].join(".")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/mongo_db.rb
DELETED