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
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_doc
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 6
8
- - 26
9
- version: 0.6.26
4
+ prerelease:
5
+ version: 0.6.27
10
6
  platform: ruby
11
7
  authors:
12
8
  - Les Hill
@@ -14,36 +10,28 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-12-06 00:00:00 -05:00
13
+ date: 2011-03-05 00:00:00 -05:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
- name: activesupport
17
+ name: activemodel
22
18
  prerelease: false
23
19
  requirement: &id001 !ruby/object:Gem::Requirement
24
20
  none: false
25
21
  requirements:
26
22
  - - ">="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 0
31
- - 0
32
24
  version: 3.0.0
33
25
  type: :runtime
34
26
  version_requirements: *id001
35
27
  - !ruby/object:Gem::Dependency
36
- name: activemodel
28
+ name: activesupport
37
29
  prerelease: false
38
30
  requirement: &id002 !ruby/object:Gem::Requirement
39
31
  none: false
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 3
45
- - 0
46
- - 0
47
35
  version: 3.0.0
48
36
  type: :runtime
49
37
  version_requirements: *id002
@@ -55,10 +43,6 @@ dependencies:
55
43
  requirements:
56
44
  - - "="
57
45
  - !ruby/object:Gem::Version
58
- segments:
59
- - 1
60
- - 0
61
- - 4
62
46
  version: 1.0.4
63
47
  type: :runtime
64
48
  version_requirements: *id003
@@ -70,10 +54,6 @@ dependencies:
70
54
  requirements:
71
55
  - - "="
72
56
  - !ruby/object:Gem::Version
73
- segments:
74
- - 1
75
- - 0
76
- - 4
77
57
  version: 1.0.4
78
58
  type: :runtime
79
59
  version_requirements: *id004
@@ -85,10 +65,6 @@ dependencies:
85
65
  requirements:
86
66
  - - ">="
87
67
  - !ruby/object:Gem::Version
88
- segments:
89
- - 1
90
- - 0
91
- - 0
92
68
  version: 1.0.0
93
69
  type: :runtime
94
70
  version_requirements: *id005
@@ -100,10 +76,6 @@ dependencies:
100
76
  requirements:
101
77
  - - ">="
102
78
  - !ruby/object:Gem::Version
103
- segments:
104
- - 0
105
- - 3
106
- - 22
107
79
  version: 0.3.22
108
80
  type: :runtime
109
81
  version_requirements: *id006
@@ -115,121 +87,45 @@ dependencies:
115
87
  requirements:
116
88
  - - ">="
117
89
  - !ruby/object:Gem::Version
118
- segments:
119
- - 0
120
- - 8
121
- - 5
122
- version: 0.8.5
90
+ version: 0.10.0
123
91
  type: :development
124
92
  version_requirements: *id007
125
93
  - !ruby/object:Gem::Dependency
126
- name: jeweler
94
+ name: rspec
127
95
  prerelease: false
128
96
  requirement: &id008 !ruby/object:Gem::Requirement
129
97
  none: false
130
98
  requirements:
131
99
  - - ">="
132
100
  - !ruby/object:Gem::Version
133
- segments:
134
- - 1
135
- - 4
136
- - 0
137
- version: 1.4.0
101
+ version: 2.5.0
138
102
  type: :development
139
103
  version_requirements: *id008
140
- - !ruby/object:Gem::Dependency
141
- name: rspec
142
- prerelease: false
143
- requirement: &id009 !ruby/object:Gem::Requirement
144
- none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- segments:
149
- - 2
150
- - 0
151
- - 0
152
- version: 2.0.0
153
- type: :development
154
- version_requirements: *id009
155
104
  description: ODM for MongoDB
156
105
  email: leshill@gmail.com
157
106
  executables: []
158
107
 
159
108
  extensions: []
160
109
 
161
- extra_rdoc_files:
162
- - LICENSE
163
- - README.textile
110
+ extra_rdoc_files: []
111
+
164
112
  files:
165
- - .document
166
- - .gitignore
167
- - .rspec
168
- - .rvmrc
169
- - .watchr
170
- - Gemfile
171
- - Gemfile.lock
172
- - HISTORY.md
173
- - LICENSE
174
- - README.textile
175
- - Rakefile
176
- - VERSION
177
- - examples/simple_document.rb
178
- - examples/simple_object.rb
179
- - features/collections.feature
180
- - features/connection.feature
181
- - features/db_references.feature
182
- - features/embed_hash.feature
183
- - features/finders.feature
184
- - features/indexes.feature
185
- - features/mongodb.yml
186
- - features/mongodoc_base.feature
187
- - features/new_record.feature
188
- - features/partial_updates.feature
189
- - features/polymorphic_collections.feature
190
- - features/references.feature
191
- - features/removing_documents.feature
192
- - features/saving_an_object.feature
193
- - features/scopes.feature
194
- - features/step_definitions/collection_steps.rb
195
- - features/step_definitions/connection_steps.rb
196
- - features/step_definitions/document_steps.rb
197
- - features/step_definitions/documents.rb
198
- - features/step_definitions/embed_hash_steps.rb
199
- - features/step_definitions/field_steps.rb
200
- - features/step_definitions/finder_steps.rb
201
- - features/step_definitions/index_steps.rb
202
- - features/step_definitions/json_steps.rb
203
- - features/step_definitions/object_steps.rb
204
- - features/step_definitions/objects.rb
205
- - features/step_definitions/partial_update_steps.rb
206
- - features/step_definitions/query_steps.rb
207
- - features/step_definitions/removing_documents_steps.rb
208
- - features/step_definitions/scope_steps.rb
209
- - features/step_definitions/string_casting_steps.rb
210
- - features/step_definitions/util_steps.rb
211
- - features/string_casting.feature
212
- - features/support/support.rb
213
- - features/timestamps.feature
214
- - features/using_criteria.feature
215
- - lib/mongo_doc.rb
216
- - lib/mongo_doc/associations.rb
217
113
  - lib/mongo_doc/associations/collection_proxy.rb
218
114
  - lib/mongo_doc/associations/document_proxy.rb
219
115
  - lib/mongo_doc/associations/hash_proxy.rb
220
116
  - lib/mongo_doc/associations/proxy_base.rb
117
+ - lib/mongo_doc/associations.rb
221
118
  - lib/mongo_doc/attributes.rb
222
119
  - lib/mongo_doc/bson.rb
223
120
  - lib/mongo_doc/collection.rb
224
121
  - lib/mongo_doc/connection.rb
225
- - lib/mongo_doc/contexts.rb
226
122
  - lib/mongo_doc/contexts/ids.rb
227
123
  - lib/mongo_doc/contexts/mongo.rb
124
+ - lib/mongo_doc/contexts.rb
228
125
  - lib/mongo_doc/criteria.rb
229
126
  - lib/mongo_doc/cursor.rb
230
127
  - lib/mongo_doc/database_cleaner.rb
231
128
  - lib/mongo_doc/document.rb
232
- - lib/mongo_doc/ext.rb
233
129
  - lib/mongo_doc/ext/array.rb
234
130
  - lib/mongo_doc/ext/binary.rb
235
131
  - lib/mongo_doc/ext/boolean_class.rb
@@ -247,6 +143,7 @@ files:
247
143
  - lib/mongo_doc/ext/string.rb
248
144
  - lib/mongo_doc/ext/symbol.rb
249
145
  - lib/mongo_doc/ext/time.rb
146
+ - lib/mongo_doc/ext.rb
250
147
  - lib/mongo_doc/finders.rb
251
148
  - lib/mongo_doc/index.rb
252
149
  - lib/mongo_doc/matchers.rb
@@ -259,8 +156,10 @@ files:
259
156
  - lib/mongo_doc/root.rb
260
157
  - lib/mongo_doc/scope.rb
261
158
  - lib/mongo_doc/timestamps.rb
262
- - lib/mongo_doc/validations.rb
263
159
  - lib/mongo_doc/validations/validates_embedded.rb
160
+ - lib/mongo_doc/validations.rb
161
+ - lib/mongo_doc/version.rb
162
+ - lib/mongo_doc.rb
264
163
  - lib/mongoid/contexts/enumerable.rb
265
164
  - lib/mongoid/contexts/id_conversion.rb
266
165
  - lib/mongoid/contexts/paging.rb
@@ -282,59 +181,16 @@ files:
282
181
  - lib/mongoid/matchers/ne.rb
283
182
  - lib/mongoid/matchers/nin.rb
284
183
  - lib/mongoid/matchers/size.rb
285
- - mongo_doc.gemspec
286
- - mongodb.example.yml
287
- - perf/mongo_doc_object.rb
288
- - perf/mongo_document.rb
289
- - perf/ruby_driver.rb
290
- - script/console
291
- - spec/active_model_behavior.rb
292
- - spec/array_including_argument_matcher.rb
293
- - spec/associations/collection_proxy_spec.rb
294
- - spec/associations/document_proxy_spec.rb
295
- - spec/associations/hash_proxy_spec.rb
296
- - spec/associations/proxy_base_spec.rb
297
- - spec/associations_spec.rb
298
- - spec/attributes_accessor_spec.rb
299
- - spec/attributes_spec.rb
300
- - spec/bson_matchers.rb
301
- - spec/bson_spec.rb
302
- - spec/collection_spec.rb
303
- - spec/connection_spec.rb
304
- - spec/contexts/ids_spec.rb
305
- - spec/contexts/mongo_spec.rb
306
- - spec/contexts_spec.rb
307
- - spec/criteria/optional_spec.rb
308
- - spec/criteria_spec.rb
309
- - spec/cursor_spec.rb
310
- - spec/database_cleaner_spec.rb
311
- - spec/document_ext.rb
312
- - spec/document_spec.rb
313
- - spec/embedded_save_spec.rb
314
- - spec/ext_spec.rb
315
- - spec/finders_spec.rb
316
- - spec/hash_matchers.rb
317
- - spec/index_spec.rb
318
- - spec/matchers_spec.rb
319
- - spec/mongodb.yml
320
- - spec/mongodb_pairs.yml
321
- - spec/new_record_spec.rb
322
- - spec/polymorphic_collection_spec.rb
323
- - spec/references_many_spec.rb
324
- - spec/references_spec.rb
325
- - spec/root_spec.rb
326
- - spec/scope_spec.rb
327
- - spec/spec_helper.rb
328
- - spec/timestamps_spec.rb
329
- - spec/update_spec.rb
330
- - spec/validations_spec.rb
184
+ - LICENSE
185
+ - README.textile
186
+ - Rakefile
331
187
  has_rdoc: true
332
188
  homepage: http://github.com/leshill/mongodoc
333
189
  licenses: []
334
190
 
335
191
  post_install_message:
336
- rdoc_options:
337
- - --charset=UTF-8
192
+ rdoc_options: []
193
+
338
194
  require_paths:
339
195
  - lib
340
196
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -342,62 +198,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
342
198
  requirements:
343
199
  - - ">="
344
200
  - !ruby/object:Gem::Version
345
- segments:
346
- - 0
347
201
  version: "0"
348
202
  required_rubygems_version: !ruby/object:Gem::Requirement
349
203
  none: false
350
204
  requirements:
351
205
  - - ">="
352
206
  - !ruby/object:Gem::Version
353
- segments:
354
- - 0
355
- version: "0"
207
+ version: 1.3.6
356
208
  requirements: []
357
209
 
358
210
  rubyforge_project:
359
- rubygems_version: 1.3.7
211
+ rubygems_version: 1.6.0
360
212
  signing_key:
361
213
  specification_version: 3
362
214
  summary: ODM for MongoDB
363
- test_files:
364
- - spec/active_model_behavior.rb
365
- - spec/array_including_argument_matcher.rb
366
- - spec/associations/collection_proxy_spec.rb
367
- - spec/associations/document_proxy_spec.rb
368
- - spec/associations/hash_proxy_spec.rb
369
- - spec/associations/proxy_base_spec.rb
370
- - spec/associations_spec.rb
371
- - spec/attributes_accessor_spec.rb
372
- - spec/attributes_spec.rb
373
- - spec/bson_matchers.rb
374
- - spec/bson_spec.rb
375
- - spec/collection_spec.rb
376
- - spec/connection_spec.rb
377
- - spec/contexts/ids_spec.rb
378
- - spec/contexts/mongo_spec.rb
379
- - spec/contexts_spec.rb
380
- - spec/criteria/optional_spec.rb
381
- - spec/criteria_spec.rb
382
- - spec/cursor_spec.rb
383
- - spec/database_cleaner_spec.rb
384
- - spec/document_ext.rb
385
- - spec/document_spec.rb
386
- - spec/embedded_save_spec.rb
387
- - spec/ext_spec.rb
388
- - spec/finders_spec.rb
389
- - spec/hash_matchers.rb
390
- - spec/index_spec.rb
391
- - spec/matchers_spec.rb
392
- - spec/new_record_spec.rb
393
- - spec/polymorphic_collection_spec.rb
394
- - spec/references_many_spec.rb
395
- - spec/references_spec.rb
396
- - spec/root_spec.rb
397
- - spec/scope_spec.rb
398
- - spec/spec_helper.rb
399
- - spec/timestamps_spec.rb
400
- - spec/update_spec.rb
401
- - spec/validations_spec.rb
402
- - examples/simple_document.rb
403
- - examples/simple_object.rb
215
+ test_files: []
216
+
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- .bundle
2
- *.sw?
3
- .DS_Store
4
- coverage
5
- rdoc
6
- pkg
7
- mongod.yml
8
- nohup.out
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --colour
2
- --format nested
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm gemset use mongo_doc
data/.watchr DELETED
@@ -1,32 +0,0 @@
1
- # vim:set filetype=ruby:
2
- def run(cmd)
3
- puts cmd
4
- system cmd
5
- end
6
-
7
- def spec(file)
8
- if File.exists?(file)
9
- run("rspec #{file}")
10
- else
11
- puts("Spec: #{file} does not exist.")
12
- end
13
- end
14
-
15
- def feature(file)
16
- if File.exists?(file)
17
- run("cucumber #{file}")
18
- else
19
- puts("Feature: #{file} does not exist.")
20
- end
21
- end
22
-
23
- watch("spec/.*_spec\.rb") do |match|
24
- puts(match[0])
25
- spec(match[0])
26
- end
27
-
28
- watch("features/.*\.feature") do |match|
29
- puts(match[0])
30
- feature(match[0])
31
- end
32
-
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source :rubygems
2
-
3
- gemspec
data/Gemfile.lock DELETED
@@ -1,72 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- mongo_doc (0.6.25)
5
- activemodel (>= 3.0.0)
6
- activesupport (>= 3.0.0)
7
- bson (= 1.0.4)
8
- bson_ext (= 1.0.4)
9
- mongo (>= 1.0.0)
10
- tzinfo (>= 0.3.22)
11
-
12
- GEM
13
- remote: http://rubygems.org/
14
- specs:
15
- activemodel (3.0.0)
16
- activesupport (= 3.0.0)
17
- builder (~> 2.1.2)
18
- i18n (~> 0.4.1)
19
- activesupport (3.0.0)
20
- bson (1.0.4)
21
- bson_ext (1.0.4)
22
- builder (2.1.2)
23
- cucumber (0.9.2)
24
- builder (~> 2.1.2)
25
- diff-lcs (~> 1.1.2)
26
- gherkin (~> 2.2.5)
27
- json (~> 1.4.6)
28
- term-ansicolor (~> 1.0.5)
29
- diff-lcs (1.1.2)
30
- gemcutter (0.6.1)
31
- gherkin (2.2.8)
32
- json (~> 1.4.6)
33
- term-ansicolor (~> 1.0.5)
34
- git (1.2.5)
35
- i18n (0.4.1)
36
- jeweler (1.4.0)
37
- gemcutter (>= 0.1.0)
38
- git (>= 1.2.5)
39
- rubyforge (>= 2.0.0)
40
- json (1.4.6)
41
- json_pure (1.4.6)
42
- mongo (1.0.7)
43
- bson (>= 1.0.4)
44
- rspec (2.0.0)
45
- rspec-core (= 2.0.0)
46
- rspec-expectations (= 2.0.0)
47
- rspec-mocks (= 2.0.0)
48
- rspec-core (2.0.0)
49
- rspec-expectations (2.0.0)
50
- diff-lcs (>= 1.1.2)
51
- rspec-mocks (2.0.0)
52
- rspec-core (= 2.0.0)
53
- rspec-expectations (= 2.0.0)
54
- rubyforge (2.0.4)
55
- json_pure (>= 1.1.7)
56
- term-ansicolor (1.0.5)
57
- tzinfo (0.3.23)
58
-
59
- PLATFORMS
60
- ruby
61
-
62
- DEPENDENCIES
63
- activemodel (>= 3.0.0)
64
- activesupport (>= 3.0.0)
65
- bson (= 1.0.4)
66
- bson_ext (= 1.0.4)
67
- cucumber (>= 0.8.5)
68
- jeweler (>= 1.4.0)
69
- mongo (>= 1.0.0)
70
- mongo_doc!
71
- rspec (>= 2.0.0)
72
- tzinfo (>= 0.3.22)
data/HISTORY.md DELETED
@@ -1,11 +0,0 @@
1
- ## 0.5.0 to 0.5.5
2
-
3
- * update to ruby driver 0.20.1 and the new bson gems
4
- * require MongoDB 1.4
5
- * can be used with ActiveSupport 2 or 3
6
- * Rails3 support with [MongoDoc-Rails](http://github.com/leshill/mongo_doc-rails) thanks to elliotcm
7
-
8
- ## 0.4.2
9
-
10
- * `Document#update_attributes` uses $ positional operator when used from within an embed_many association
11
- * Require MongoDB 1.3.4 or greater
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.6.26
@@ -1,46 +0,0 @@
1
- require 'mongo_doc'
2
-
3
- class Address
4
- include MongoDoc::Document
5
-
6
- attr_accessor :street
7
- attr_accessor :city
8
- attr_accessor :state
9
- attr_accessor :zip_code
10
- attr_accessor :phone_number
11
- end
12
-
13
- class Contact
14
- include MongoDoc::Document
15
-
16
- attr_accessor :name
17
- attr_accessor :interests
18
- embed_many :addresses
19
-
20
- scope :in_state, lambda {|state| where('addresses.state' => state)}
21
- end
22
-
23
- Contact.collection.drop
24
-
25
- contact = Contact.new(:name => 'Hashrocket', :interests => ['ruby', 'rails', 'agile'])
26
- contact.addresses << Address.new(:street => '320 1st Street North, #712', :city => 'Jacksonville Beach', :state => 'FL', :zip_code => '32250', :phone_number => '877 885 8846')
27
- contact.save
28
-
29
- # Finders
30
- Contact.find_all.each {|c| puts c.name}
31
- puts contact.to_param
32
- puts Contact.find_one(contact.to_param).addresses.first.street
33
- Contact.find(contact.to_param).each {|c| puts c.name}
34
-
35
- hashrocket_in_fl = Contact.in_state('FL').where(:name => /rocket/)
36
-
37
- hashrocket_address = hashrocket_in_fl.first.addresses.first
38
- hashrocket_address.update_attributes(:street => '320 First Street North, #712')
39
-
40
- puts Contact.where(:name => 'Hashrocket').first.addresses.first.street
41
-
42
- # Criteria behave like new AR3 AREL queries
43
- hr = Contact.where(:name => 'Hashrocket')
44
- hr_in = hr.where('addresses.state' => 'IN')
45
- puts hr.count
46
- puts hr_in.count
@@ -1,34 +0,0 @@
1
- require 'mongo_doc'
2
-
3
- class Contact
4
- attr_accessor :name, :addresses, :interests
5
- end
6
-
7
- class Address
8
- attr_accessor :street, :city, :state, :zip, :phone_number
9
- end
10
-
11
- collection = MongoDoc::Collection.new('contacts')
12
- collection.drop
13
-
14
- contact = Contact.new
15
- contact.name = 'Hashrocket'
16
- contact.interests = ['ruby', 'rails', 'agile']
17
-
18
- address = Address.new
19
- address.street = '320 First Street North, #712'
20
- address.city = 'Jacksonville Beach'
21
- address.state = 'FL'
22
- address.zip = '32250'
23
- address.phone_number = '877 885 8846'
24
- contact.addresses = [address]
25
-
26
- collection.save(contact)
27
-
28
- in_florida = collection.where('addresses.state' => 'FL')
29
- puts in_florida.first.addresses.first.phone_number
30
- rocket_oid_names = collection.where('name' => /rocket/)
31
- puts rocket_oid_names.first.addresses.first.phone_number
32
- interested_in_ruby = collection.in('interests' => ['ruby'])
33
- puts interested_in_ruby.first.addresses.first.phone_number
34
-
@@ -1,9 +0,0 @@
1
- Feature: Collection with Criteria
2
-
3
- Scenario: saving a ruby object
4
- Given a new collection named 'test'
5
- And an object 'movie'
6
- When I save the object 'movie'
7
- And I query the collection 'test' with the criteria where(:title => 'Gone with the Wind')
8
- Then the query result has 1 documents
9
-
@@ -1,13 +0,0 @@
1
- Feature: Setting a Connection Manually
2
-
3
- Scenario: Setting the connection manually
4
- Given a new connection to the database "with_auth" with user "test" and password "test"
5
- And a new collection named 'test'
6
- And an object 'movie'
7
- When I save the object 'movie'
8
- And I query the collection 'test' with the criteria where(:title => 'Gone with the Wind')
9
- Then the query result has 1 documents
10
-
11
- Scenario: Failing auth with manual connection
12
- When a new connection to the database "with_auth" with user "test" and password "bad"
13
- Then a "Mongo::AuthenticationError" exception is thrown
@@ -1,21 +0,0 @@
1
- Feature: DBReferences
2
-
3
- Background:
4
- Given an empty Character document collection
5
- And a Character document named 'Fry' :
6
- | Name |
7
- | Philip J. Fry |
8
- And an empty Address document collection
9
- And an Address document named 'office' :
10
- | City |
11
- | New New York City |
12
- And an Address document named 'old_office' :
13
- | City |
14
- | New York City |
15
-
16
- Scenario: Automatically dereferences in db_references association
17
- When I save the document 'office'
18
- And 'Fry' references 'office' as 'address'
19
- And I save the document 'Fry'
20
- And the document 'Fry' is reloaded
21
- Then 'Fry' refers to 'office' as 'address'
@@ -1,16 +0,0 @@
1
- Feature: Embed Hash
2
-
3
- Background:
4
- Given a class Event
5
-
6
- Scenario: Creating a new document
7
- Given an Event document named 'event' :
8
- | Name | Venue | Date |
9
- | NoSQL Live | John Hancock Conference Center | 2010-03-11 |
10
- And an Address document named 'address' :
11
- | Street | City | State | Zip Code |
12
- | 320 First Street North | Jacksonville Beach | FL | 32250 |
13
- And I put the 'address' object on key 'office' of the 'addresses' hash of 'event'
14
- When I save the document 'event'
15
- Then the last return value is true
16
- And the document 'event' roundtrips