mongo_doc 0.6.26 → 0.6.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. data/README.textile +14 -203
  2. data/Rakefile +0 -134
  3. data/lib/mongo_doc/collection.rb +4 -0
  4. data/lib/mongo_doc/finders.rb +1 -0
  5. data/lib/mongo_doc/timestamps.rb +4 -3
  6. data/lib/mongo_doc/version.rb +3 -0
  7. data/lib/mongo_doc.rb +0 -5
  8. metadata +25 -212
  9. data/.document +0 -5
  10. data/.gitignore +0 -8
  11. data/.rspec +0 -2
  12. data/.rvmrc +0 -1
  13. data/.watchr +0 -32
  14. data/Gemfile +0 -3
  15. data/Gemfile.lock +0 -72
  16. data/HISTORY.md +0 -11
  17. data/VERSION +0 -1
  18. data/examples/simple_document.rb +0 -46
  19. data/examples/simple_object.rb +0 -34
  20. data/features/collections.feature +0 -9
  21. data/features/connection.feature +0 -13
  22. data/features/db_references.feature +0 -21
  23. data/features/embed_hash.feature +0 -16
  24. data/features/finders.feature +0 -76
  25. data/features/indexes.feature +0 -28
  26. data/features/mongodb.yml +0 -7
  27. data/features/mongodoc_base.feature +0 -128
  28. data/features/new_record.feature +0 -36
  29. data/features/partial_updates.feature +0 -95
  30. data/features/polymorphic_collections.feature +0 -16
  31. data/features/references.feature +0 -28
  32. data/features/removing_documents.feature +0 -68
  33. data/features/saving_an_object.feature +0 -15
  34. data/features/scopes.feature +0 -66
  35. data/features/step_definitions/collection_steps.rb +0 -17
  36. data/features/step_definitions/connection_steps.rb +0 -13
  37. data/features/step_definitions/document_steps.rb +0 -155
  38. data/features/step_definitions/documents.rb +0 -61
  39. data/features/step_definitions/embed_hash_steps.rb +0 -6
  40. data/features/step_definitions/field_steps.rb +0 -28
  41. data/features/step_definitions/finder_steps.rb +0 -15
  42. data/features/step_definitions/index_steps.rb +0 -10
  43. data/features/step_definitions/json_steps.rb +0 -9
  44. data/features/step_definitions/object_steps.rb +0 -50
  45. data/features/step_definitions/objects.rb +0 -24
  46. data/features/step_definitions/partial_update_steps.rb +0 -31
  47. data/features/step_definitions/query_steps.rb +0 -69
  48. data/features/step_definitions/removing_documents_steps.rb +0 -14
  49. data/features/step_definitions/scope_steps.rb +0 -18
  50. data/features/step_definitions/string_casting_steps.rb +0 -29
  51. data/features/step_definitions/util_steps.rb +0 -7
  52. data/features/string_casting.feature +0 -10
  53. data/features/support/support.rb +0 -12
  54. data/features/timestamps.feature +0 -14
  55. data/features/using_criteria.feature +0 -148
  56. data/mongo_doc.gemspec +0 -272
  57. data/mongodb.example.yml +0 -14
  58. data/perf/mongo_doc_object.rb +0 -83
  59. data/perf/mongo_document.rb +0 -84
  60. data/perf/ruby_driver.rb +0 -49
  61. data/script/console +0 -8
  62. data/spec/active_model_behavior.rb +0 -64
  63. data/spec/array_including_argument_matcher.rb +0 -62
  64. data/spec/associations/collection_proxy_spec.rb +0 -233
  65. data/spec/associations/document_proxy_spec.rb +0 -45
  66. data/spec/associations/hash_proxy_spec.rb +0 -181
  67. data/spec/associations/proxy_base_spec.rb +0 -92
  68. data/spec/associations_spec.rb +0 -218
  69. data/spec/attributes_accessor_spec.rb +0 -39
  70. data/spec/attributes_spec.rb +0 -184
  71. data/spec/bson_matchers.rb +0 -54
  72. data/spec/bson_spec.rb +0 -196
  73. data/spec/collection_spec.rb +0 -169
  74. data/spec/connection_spec.rb +0 -169
  75. data/spec/contexts/ids_spec.rb +0 -49
  76. data/spec/contexts/mongo_spec.rb +0 -241
  77. data/spec/contexts_spec.rb +0 -56
  78. data/spec/criteria/optional_spec.rb +0 -26
  79. data/spec/criteria_spec.rb +0 -73
  80. data/spec/cursor_spec.rb +0 -91
  81. data/spec/database_cleaner_spec.rb +0 -24
  82. data/spec/document_ext.rb +0 -9
  83. data/spec/document_spec.rb +0 -569
  84. data/spec/embedded_save_spec.rb +0 -73
  85. data/spec/ext_spec.rb +0 -100
  86. data/spec/finders_spec.rb +0 -61
  87. data/spec/hash_matchers.rb +0 -29
  88. data/spec/index_spec.rb +0 -79
  89. data/spec/matchers_spec.rb +0 -342
  90. data/spec/mongodb.yml +0 -6
  91. data/spec/mongodb_pairs.yml +0 -8
  92. data/spec/new_record_spec.rb +0 -128
  93. data/spec/polymorphic_collection_spec.rb +0 -47
  94. data/spec/references_many_spec.rb +0 -214
  95. data/spec/references_spec.rb +0 -121
  96. data/spec/root_spec.rb +0 -41
  97. data/spec/scope_spec.rb +0 -88
  98. data/spec/spec_helper.rb +0 -16
  99. data/spec/timestamps_spec.rb +0 -154
  100. data/spec/update_spec.rb +0 -167
  101. data/spec/validations_spec.rb +0 -30
@@ -1,148 +0,0 @@
1
- Feature: MongoDoc::Base
2
-
3
- Background:
4
- Given an empty Contact document collection
5
- And a Contact document named 'hashrocket' :
6
- | Name | Type |
7
- | Hashrocket | company |
8
- And 'hashrocket' has interests, an array of:
9
- | Interest |
10
- | ruby |
11
- | rails |
12
- | employment |
13
- | contract work |
14
- | restaurants |
15
- | hotels |
16
- | flights |
17
- | car rentals |
18
- And 'hashrocket' has many addresses :
19
- | Street | City | State | Zip Code |
20
- | 320 First Street North | Jacksonville Beach | FL | 32250 |
21
- | 1 Lake Michigan Street | Chicago | IL | 60611 |
22
- | 1 Main Street | Santiago | Chile | |
23
- And I save the document 'hashrocket'
24
- And a Contact document named 'rocketeer' :
25
- | Name |
26
- | Rocketeer Mike |
27
- And 'rocketeer' has interests, an array of:
28
- | Interest |
29
- | ruby |
30
- | rails |
31
- | restaurants |
32
- | employment |
33
- And 'rocketeer' has many addresses :
34
- | Street | City | State | Zip Code |
35
- | 1 Main Street | Atlantic Beach | FL | 32233 |
36
- And I save the document 'rocketeer'
37
- And a Contact document named 'contractor' :
38
- | Name |
39
- | Contractor Joe |
40
- And 'contractor' has interests, an array of:
41
- | Interest |
42
- | ruby |
43
- | rails |
44
- | contract work |
45
- | flights |
46
- | car rentals |
47
- | hotels |
48
- | restaurants |
49
- And 'contractor' has many addresses :
50
- | Street | City | State | Zip Code |
51
- | 1 Main St. | Jacksonville | FL | 32218 |
52
- And I save the document 'contractor'
53
- And an empty Place document collection
54
- And a Place document named 'one_ocean' :
55
- | Name | Type |
56
- | One Ocean | hotel |
57
- And 'one_ocean' has one Address as address :
58
- | Street | City | State | Zip Code |
59
- | 1 Ocean Street | Atlantic Beach | FL | 32233 |
60
- And I save the document 'one_ocean'
61
- And a Place document named 'sea_horse' :
62
- | Name | Type |
63
- | Sea Horse | hotel |
64
- And 'sea_horse' has one Address as address :
65
- | Street | City | State | Zip Code |
66
- | 1401 Atlantic Blvd | Neptune Beach | FL | 32266 |
67
- And I save the document 'sea_horse'
68
- And a Place document named 'jax' :
69
- | Name | Type |
70
- | Jacksonville International Airport | airport |
71
- And 'jax' has one Address as address :
72
- | Street | City | State | Zip Code |
73
- | | Jacksonville | FL | 32218 |
74
- And I save the document 'jax'
75
-
76
- Scenario: Counting results
77
- When I query contacts with criteria all('interests' => ['ruby', 'rails', 'employment'])
78
- Then the query result has 2 documents
79
-
80
- Scenario: Finding contacts with interests in ruby and rails
81
- When I query contacts with criteria all('interests' => ['ruby', 'rails', 'employment'])
82
- Then one of the query results is the document 'rocketeer'
83
-
84
- Scenario: Finding contacts with interests in restaurants or hotels
85
- When I query contacts with criteria in('interests' => ['restaurants', 'hotels'])
86
- Then one of the query results is the document 'contractor'
87
-
88
- Scenario: Aggregating Places
89
- When I query places with criteria only('type').where('address.state' => 'FL').aggregate
90
- Then the query result with "type" == "hotel" has a count of 2
91
-
92
- Scenario: Excluding places in Neptune Beach
93
- When I query places with criteria only('type').where('address.city' => 'Neptune Beach').aggregate
94
- Then the query result with "type" == "hotel" has a count of 1
95
-
96
- Scenario: Using extras to limit results
97
- When I query contacts with criteria all('interests' => ['ruby', 'rails', 'employment']).limit(1)
98
- Then the size of the query result is 1
99
-
100
- Scenario: Finding the first result
101
- When I query contacts with criteria all('interests' => ['ruby', 'rails', 'employment']).first
102
- Then the query result is equal to the document 'hashrocket'
103
-
104
- Scenario: Grouping places by type
105
- When I query places with criteria only('type').where('type' => 'hotel').group
106
- Then the query result with "type" == "hotel" has the document 'one_ocean'
107
-
108
- Scenario: Selecting contacts with in operator
109
- When I query contacts with criteria in('interests' => ['ruby', 'rails', 'employment'])
110
- Then the query result has 3 documents
111
-
112
- Scenario: Selecting a contact with the id operator
113
- When I query contacts with the 'hashrocket' id
114
- Then the query result has 1 documents
115
- And the query result is the document 'hashrocket'
116
-
117
- Scenario: Selecting contacts with not in operator
118
- When I query contacts with criteria not_in('interests' => ['contract work', 'employment'])
119
- Then the query result has 0 documents
120
-
121
- Scenario: Ordering contacts
122
- When I query contacts with criteria in('interests' => ['ruby', 'rails']).order_by([[:name, :asc]]).entries
123
- Then the first query result is the document 'contractor'
124
- And the last query result is the document 'rocketeer'
125
-
126
- Scenario: Criteria can be reused
127
- Given I query contacts with criteria in('interests' => ['ruby', 'rails']).order_by([[:name, :desc]])
128
- And the first query result is the document 'rocketeer'
129
- When I requery
130
- Then the first query result is the document 'rocketeer'
131
-
132
- Scenario: Using skip on results
133
- When I query contacts with criteria all('interests' => ['ruby', 'rails']).skip(1)
134
- Then the size of the query result is 2
135
-
136
- Scenario: Is a criteria blank?
137
- When I query contacts with criteria all('interests' => ['wii'])
138
- Then the query is blank
139
-
140
- Scenario: Is a criteria empty?
141
- When I query contacts with criteria all('interests' => ['ruby'])
142
- Then the query is not empty
143
-
144
- Scenario: Criteria return a new criteria
145
- When I query contacts with criteria all('interests' => ['ruby'])
146
- And I also want a second query with criteria where('addresses.state' => 'HI')
147
- Then the query is not empty
148
- And the second query is empty
data/mongo_doc.gemspec DELETED
@@ -1,272 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{mongo_doc}
8
- s.version = "0.6.26"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Les Hill"]
12
- s.date = %q{2010-12-06}
13
- s.description = %q{ODM for MongoDB}
14
- s.email = %q{leshill@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.textile"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- ".rspec",
23
- ".rvmrc",
24
- ".watchr",
25
- "Gemfile",
26
- "Gemfile.lock",
27
- "HISTORY.md",
28
- "LICENSE",
29
- "README.textile",
30
- "Rakefile",
31
- "VERSION",
32
- "examples/simple_document.rb",
33
- "examples/simple_object.rb",
34
- "features/collections.feature",
35
- "features/connection.feature",
36
- "features/db_references.feature",
37
- "features/embed_hash.feature",
38
- "features/finders.feature",
39
- "features/indexes.feature",
40
- "features/mongodb.yml",
41
- "features/mongodoc_base.feature",
42
- "features/new_record.feature",
43
- "features/partial_updates.feature",
44
- "features/polymorphic_collections.feature",
45
- "features/references.feature",
46
- "features/removing_documents.feature",
47
- "features/saving_an_object.feature",
48
- "features/scopes.feature",
49
- "features/step_definitions/collection_steps.rb",
50
- "features/step_definitions/connection_steps.rb",
51
- "features/step_definitions/document_steps.rb",
52
- "features/step_definitions/documents.rb",
53
- "features/step_definitions/embed_hash_steps.rb",
54
- "features/step_definitions/field_steps.rb",
55
- "features/step_definitions/finder_steps.rb",
56
- "features/step_definitions/index_steps.rb",
57
- "features/step_definitions/json_steps.rb",
58
- "features/step_definitions/object_steps.rb",
59
- "features/step_definitions/objects.rb",
60
- "features/step_definitions/partial_update_steps.rb",
61
- "features/step_definitions/query_steps.rb",
62
- "features/step_definitions/removing_documents_steps.rb",
63
- "features/step_definitions/scope_steps.rb",
64
- "features/step_definitions/string_casting_steps.rb",
65
- "features/step_definitions/util_steps.rb",
66
- "features/string_casting.feature",
67
- "features/support/support.rb",
68
- "features/timestamps.feature",
69
- "features/using_criteria.feature",
70
- "lib/mongo_doc.rb",
71
- "lib/mongo_doc/associations.rb",
72
- "lib/mongo_doc/associations/collection_proxy.rb",
73
- "lib/mongo_doc/associations/document_proxy.rb",
74
- "lib/mongo_doc/associations/hash_proxy.rb",
75
- "lib/mongo_doc/associations/proxy_base.rb",
76
- "lib/mongo_doc/attributes.rb",
77
- "lib/mongo_doc/bson.rb",
78
- "lib/mongo_doc/collection.rb",
79
- "lib/mongo_doc/connection.rb",
80
- "lib/mongo_doc/contexts.rb",
81
- "lib/mongo_doc/contexts/ids.rb",
82
- "lib/mongo_doc/contexts/mongo.rb",
83
- "lib/mongo_doc/criteria.rb",
84
- "lib/mongo_doc/cursor.rb",
85
- "lib/mongo_doc/database_cleaner.rb",
86
- "lib/mongo_doc/document.rb",
87
- "lib/mongo_doc/ext.rb",
88
- "lib/mongo_doc/ext/array.rb",
89
- "lib/mongo_doc/ext/binary.rb",
90
- "lib/mongo_doc/ext/boolean_class.rb",
91
- "lib/mongo_doc/ext/code.rb",
92
- "lib/mongo_doc/ext/date.rb",
93
- "lib/mongo_doc/ext/date_time.rb",
94
- "lib/mongo_doc/ext/dbref.rb",
95
- "lib/mongo_doc/ext/hash.rb",
96
- "lib/mongo_doc/ext/min_max_keys.rb",
97
- "lib/mongo_doc/ext/nil_class.rb",
98
- "lib/mongo_doc/ext/numeric.rb",
99
- "lib/mongo_doc/ext/object.rb",
100
- "lib/mongo_doc/ext/object_id.rb",
101
- "lib/mongo_doc/ext/regexp.rb",
102
- "lib/mongo_doc/ext/string.rb",
103
- "lib/mongo_doc/ext/symbol.rb",
104
- "lib/mongo_doc/ext/time.rb",
105
- "lib/mongo_doc/finders.rb",
106
- "lib/mongo_doc/index.rb",
107
- "lib/mongo_doc/matchers.rb",
108
- "lib/mongo_doc/polymorphic_collection.rb",
109
- "lib/mongo_doc/railtie.rb",
110
- "lib/mongo_doc/railties/config.rb",
111
- "lib/mongo_doc/railties/db.task",
112
- "lib/mongo_doc/references.rb",
113
- "lib/mongo_doc/references_many.rb",
114
- "lib/mongo_doc/root.rb",
115
- "lib/mongo_doc/scope.rb",
116
- "lib/mongo_doc/timestamps.rb",
117
- "lib/mongo_doc/validations.rb",
118
- "lib/mongo_doc/validations/validates_embedded.rb",
119
- "lib/mongoid/contexts/enumerable.rb",
120
- "lib/mongoid/contexts/id_conversion.rb",
121
- "lib/mongoid/contexts/paging.rb",
122
- "lib/mongoid/criteria.rb",
123
- "lib/mongoid/criterion/complex.rb",
124
- "lib/mongoid/criterion/exclusion.rb",
125
- "lib/mongoid/criterion/inclusion.rb",
126
- "lib/mongoid/criterion/optional.rb",
127
- "lib/mongoid/extensions/hash/criteria_helpers.rb",
128
- "lib/mongoid/extensions/symbol/inflections.rb",
129
- "lib/mongoid/matchers/all.rb",
130
- "lib/mongoid/matchers/default.rb",
131
- "lib/mongoid/matchers/exists.rb",
132
- "lib/mongoid/matchers/gt.rb",
133
- "lib/mongoid/matchers/gte.rb",
134
- "lib/mongoid/matchers/in.rb",
135
- "lib/mongoid/matchers/lt.rb",
136
- "lib/mongoid/matchers/lte.rb",
137
- "lib/mongoid/matchers/ne.rb",
138
- "lib/mongoid/matchers/nin.rb",
139
- "lib/mongoid/matchers/size.rb",
140
- "mongo_doc.gemspec",
141
- "mongodb.example.yml",
142
- "perf/mongo_doc_object.rb",
143
- "perf/mongo_document.rb",
144
- "perf/ruby_driver.rb",
145
- "script/console",
146
- "spec/active_model_behavior.rb",
147
- "spec/array_including_argument_matcher.rb",
148
- "spec/associations/collection_proxy_spec.rb",
149
- "spec/associations/document_proxy_spec.rb",
150
- "spec/associations/hash_proxy_spec.rb",
151
- "spec/associations/proxy_base_spec.rb",
152
- "spec/associations_spec.rb",
153
- "spec/attributes_accessor_spec.rb",
154
- "spec/attributes_spec.rb",
155
- "spec/bson_matchers.rb",
156
- "spec/bson_spec.rb",
157
- "spec/collection_spec.rb",
158
- "spec/connection_spec.rb",
159
- "spec/contexts/ids_spec.rb",
160
- "spec/contexts/mongo_spec.rb",
161
- "spec/contexts_spec.rb",
162
- "spec/criteria/optional_spec.rb",
163
- "spec/criteria_spec.rb",
164
- "spec/cursor_spec.rb",
165
- "spec/database_cleaner_spec.rb",
166
- "spec/document_ext.rb",
167
- "spec/document_spec.rb",
168
- "spec/embedded_save_spec.rb",
169
- "spec/ext_spec.rb",
170
- "spec/finders_spec.rb",
171
- "spec/hash_matchers.rb",
172
- "spec/index_spec.rb",
173
- "spec/matchers_spec.rb",
174
- "spec/mongodb.yml",
175
- "spec/mongodb_pairs.yml",
176
- "spec/new_record_spec.rb",
177
- "spec/polymorphic_collection_spec.rb",
178
- "spec/references_many_spec.rb",
179
- "spec/references_spec.rb",
180
- "spec/root_spec.rb",
181
- "spec/scope_spec.rb",
182
- "spec/spec_helper.rb",
183
- "spec/timestamps_spec.rb",
184
- "spec/update_spec.rb",
185
- "spec/validations_spec.rb"
186
- ]
187
- s.homepage = %q{http://github.com/leshill/mongodoc}
188
- s.rdoc_options = ["--charset=UTF-8"]
189
- s.require_paths = ["lib"]
190
- s.rubygems_version = %q{1.3.7}
191
- s.summary = %q{ODM for MongoDB}
192
- s.test_files = [
193
- "spec/active_model_behavior.rb",
194
- "spec/array_including_argument_matcher.rb",
195
- "spec/associations/collection_proxy_spec.rb",
196
- "spec/associations/document_proxy_spec.rb",
197
- "spec/associations/hash_proxy_spec.rb",
198
- "spec/associations/proxy_base_spec.rb",
199
- "spec/associations_spec.rb",
200
- "spec/attributes_accessor_spec.rb",
201
- "spec/attributes_spec.rb",
202
- "spec/bson_matchers.rb",
203
- "spec/bson_spec.rb",
204
- "spec/collection_spec.rb",
205
- "spec/connection_spec.rb",
206
- "spec/contexts/ids_spec.rb",
207
- "spec/contexts/mongo_spec.rb",
208
- "spec/contexts_spec.rb",
209
- "spec/criteria/optional_spec.rb",
210
- "spec/criteria_spec.rb",
211
- "spec/cursor_spec.rb",
212
- "spec/database_cleaner_spec.rb",
213
- "spec/document_ext.rb",
214
- "spec/document_spec.rb",
215
- "spec/embedded_save_spec.rb",
216
- "spec/ext_spec.rb",
217
- "spec/finders_spec.rb",
218
- "spec/hash_matchers.rb",
219
- "spec/index_spec.rb",
220
- "spec/matchers_spec.rb",
221
- "spec/new_record_spec.rb",
222
- "spec/polymorphic_collection_spec.rb",
223
- "spec/references_many_spec.rb",
224
- "spec/references_spec.rb",
225
- "spec/root_spec.rb",
226
- "spec/scope_spec.rb",
227
- "spec/spec_helper.rb",
228
- "spec/timestamps_spec.rb",
229
- "spec/update_spec.rb",
230
- "spec/validations_spec.rb",
231
- "examples/simple_document.rb",
232
- "examples/simple_object.rb"
233
- ]
234
-
235
- if s.respond_to? :specification_version then
236
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
237
- s.specification_version = 3
238
-
239
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
240
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
241
- s.add_runtime_dependency(%q<activemodel>, [">= 3.0.0"])
242
- s.add_runtime_dependency(%q<bson>, ["= 1.0.4"])
243
- s.add_runtime_dependency(%q<bson_ext>, ["= 1.0.4"])
244
- s.add_runtime_dependency(%q<mongo>, [">= 1.0.0"])
245
- s.add_runtime_dependency(%q<tzinfo>, [">= 0.3.22"])
246
- s.add_development_dependency(%q<cucumber>, [">= 0.8.5"])
247
- s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
248
- s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
249
- else
250
- s.add_dependency(%q<activesupport>, [">= 3.0.0"])
251
- s.add_dependency(%q<activemodel>, [">= 3.0.0"])
252
- s.add_dependency(%q<bson>, ["= 1.0.4"])
253
- s.add_dependency(%q<bson_ext>, ["= 1.0.4"])
254
- s.add_dependency(%q<mongo>, [">= 1.0.0"])
255
- s.add_dependency(%q<tzinfo>, [">= 0.3.22"])
256
- s.add_dependency(%q<cucumber>, [">= 0.8.5"])
257
- s.add_dependency(%q<jeweler>, [">= 1.4.0"])
258
- s.add_dependency(%q<rspec>, [">= 2.0.0"])
259
- end
260
- else
261
- s.add_dependency(%q<activesupport>, [">= 3.0.0"])
262
- s.add_dependency(%q<activemodel>, [">= 3.0.0"])
263
- s.add_dependency(%q<bson>, ["= 1.0.4"])
264
- s.add_dependency(%q<bson_ext>, ["= 1.0.4"])
265
- s.add_dependency(%q<mongo>, [">= 1.0.0"])
266
- s.add_dependency(%q<tzinfo>, [">= 0.3.22"])
267
- s.add_dependency(%q<cucumber>, [">= 0.8.5"])
268
- s.add_dependency(%q<jeweler>, [">= 1.4.0"])
269
- s.add_dependency(%q<rspec>, [">= 2.0.0"])
270
- end
271
- end
272
-
data/mongodb.example.yml DELETED
@@ -1,14 +0,0 @@
1
- development:
2
- name: development
3
- host: localhost
4
- port: 27017
5
- options:
6
- auto_reconnect: true
7
-
8
- test:
9
- name: test
10
- host: localhost
11
- port: 27017
12
- options:
13
- auto_reconnect: true
14
-
@@ -1,83 +0,0 @@
1
- require "rubygems"
2
- require "ruby-prof"
3
- require "mongo_doc"
4
-
5
- class Person
6
- attr_accessor :address, :birth_date, :name, :phones
7
- end
8
-
9
- class Name
10
- attr_accessor :family, :given, :middle
11
- end
12
-
13
- class Address
14
- attr_accessor :city, :post_code, :state, :street, :type
15
- end
16
-
17
- class Phone
18
- attr_accessor :country_code, :number, :type
19
- end
20
-
21
- class MongoDocObject
22
- attr_accessor :collection
23
- attr_accessor :objects
24
- attr_accessor :ids
25
-
26
- def initialize
27
- MongoDoc::Connection.name = 'mongo_doc_object_test'
28
- self.collection = MongoDoc::Collection.new 'people'
29
- collection.drop
30
- end
31
-
32
- def generate(count)
33
- self.objects = []
34
- self.ids = []
35
- count.times do |i|
36
- person = Person.new
37
- person.birth_date = Date.new(1970, 1, 1)
38
- person.phones = []
39
-
40
- name = Name.new
41
- name.given = "James #{i}"
42
- name.family = "Kirk"
43
- name.middle = "Tiberius"
44
-
45
- address = Address.new
46
- address.street = "1 Starfleet Command Way"
47
- address.city = "San Francisco"
48
- address.state = "CA"
49
- address.post_code = "94133"
50
- address.type = "Work"
51
-
52
- phone = Phone.new
53
- phone.country_code = 1
54
- phone.number = "415-555-1212"
55
- phone.type = "Mobile"
56
-
57
- person.name = name
58
- person.address = address
59
- person.phones << phone
60
-
61
- objects << person
62
- end
63
- end
64
-
65
- def writes(count)
66
- count.times do |i|
67
- ids[i] = collection.save(objects[i])
68
- end
69
- end
70
-
71
- def reads(count)
72
- count.times do |i|
73
- obj = collection.find_one(ids[i])
74
- raise 'Not found' unless obj.name.given == objects[i].name.given
75
- end
76
- end
77
-
78
- def query_all
79
- collection.find.each do |obj|
80
- given_name = obj.name.given
81
- end
82
- end
83
- end
@@ -1,84 +0,0 @@
1
- require "benchmark"
2
- require "ruby-prof"
3
- require "mongo_doc"
4
-
5
- class Person
6
- include MongoDoc::Document
7
-
8
- attr_accessor :birth_date, :type => Date
9
-
10
- embed :name
11
- embed :address
12
- embed_many :phones
13
- end
14
-
15
- class Name
16
- include MongoDoc::Document
17
-
18
- attr_accessor :given
19
- attr_accessor :family
20
- attr_accessor :middle
21
- end
22
-
23
- class Address
24
- include MongoDoc::Document
25
-
26
- attr_accessor :street
27
- attr_accessor :city
28
- attr_accessor :state
29
- attr_accessor :post_code
30
- attr_accessor :type
31
- end
32
-
33
- class Phone
34
- include MongoDoc::Document
35
-
36
- attr_accessor :country_code
37
- attr_accessor :number
38
- attr_accessor :type
39
- end
40
-
41
- class MongoDocument
42
- attr_accessor :collection
43
- attr_accessor :documents
44
-
45
- def initialize
46
- MongoDoc::Connection.name = 'mongo_doc_object_test'
47
- self.collection = MongoDoc::Collection.new 'people'
48
- collection.drop
49
- end
50
-
51
- def generate(count)
52
- self.documents = []
53
- count.times do |i|
54
- person = Person.new(:birth_date => Date.new(1970, 1, 1))
55
- name = Name.new(:given => "James #{i}", :family => "Kirk", :middle => "Tiberius")
56
- address = Address.new(:street => "1 Starfleet Command Way", :city => "San Francisco", :state => "CA", :post_code => "94133", :type => "Work")
57
- phone = Phone.new(:country_code => 1, :number => "415-555-1212", :type => "Mobile")
58
- person.name = name
59
- person.address = address
60
- person.phones << phone
61
-
62
- documents << person
63
- end
64
- end
65
-
66
- def writes(count)
67
- count.times do |i|
68
- documents[i].save
69
- end
70
- end
71
-
72
- def reads(count)
73
- count.times do |i|
74
- doc = collection.find_one(documents[i]._id)
75
- raise 'Not found' unless doc.name.given == documents[i].name.given
76
- end
77
- end
78
-
79
- def query_all
80
- collection.find.each do |doc|
81
- given_name = doc.name.given
82
- end
83
- end
84
- end
data/perf/ruby_driver.rb DELETED
@@ -1,49 +0,0 @@
1
- require "rubygems"
2
- require "ruby-prof"
3
- require "mongo_doc"
4
-
5
- class RubyDriver
6
- attr_accessor :collection
7
- attr_accessor :objects
8
- attr_accessor :ids
9
-
10
- def initialize
11
- MongoDoc::Connection.name = 'ruby_driver_test'
12
- self.collection = MongoDoc::Connection.database.collection 'people'
13
- collection.drop
14
- end
15
-
16
- def generate(count)
17
- self.objects = []
18
- self.ids = []
19
- count.times do |i|
20
- person = {:birth_date => Date.new(1970, 1, 1).to_bson, :phones => []}
21
- name = {:given => "James #{i}", :family => "Kirk", :middle => "Tiberius"}
22
- address = {:street => "1 Starfleet Command Way", :city => "San Francisco", :state => "CA", :post_code => "94133", :type => "Work"}
23
- phone = {:country_code => 1, :number => "415-555-1212", :type => "Mobile"}
24
- person[:name] = name
25
- person[:address] = address
26
- person[:phones] << phone
27
- objects << person
28
- end
29
- end
30
-
31
- def writes(count)
32
- count.times do |i|
33
- ids[i] = collection.save(objects[i])
34
- end
35
- end
36
-
37
- def reads(count)
38
- count.times do |i|
39
- obj = collection.find_one(ids[i])
40
- raise 'Not found' unless obj and obj['name']['given'] == objects[i][:name][:given]
41
- end
42
- end
43
-
44
- def query_all
45
- collection.find().each do |obj|
46
- given_name = obj['name']['given']
47
- end
48
- end
49
- end
data/script/console DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
-
5
- require 'irb'
6
- require 'mongo_doc'
7
-
8
- IRB.start(__FILE__)