forked from mongodb/mongoid
/
HISTORY
342 lines (240 loc) · 9.63 KB
/
HISTORY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
=== 1.2.0
- Fixed composite key generation not to replace all
special chars with dashes.
- Memory optimizations, now wrapping the mongo cursor.
- Fixed memoization on has_many_related assocations.
- Fixed pagination on embedded associations
- Fixed after_update callback not getting fired.
- When a connection failure occurs, Mongoid tried to
retry the operation up to a configurable time.
- Mongoid now supports a configuration with a master
and multiple read slaves. It will direct all writes
to the master and all reads to the slaves. In the case
of a write, subsequent reads will be directed to the
master up to configurable number to try and counter
the 2 second slave sync delay.
- Fixed issue with criteria exclusion queries with ids.
- Mongoid only executes a count when explicitly paginating.
- Fixed Criteria offset to be a getter or setter
- Added indexes to foreign keys on belongs_to_related
associations.
- General code refactorings/cleanup
=== 1.1.4
- Refactorings in preparation for next feature push.
- Associations may now have anonymous extensions.
- Ruby 1.9 compatibility updates. (brainopia)
- Document.to_json accepts options. (jsmestad)
=== 1.1.3
- Nil can be passed into methods that set attributes.
- Mongoid.config can now take a block.
- Allow named_scopes and criteria class methods on
has_many_related if related is a Mongoid document.
- Document.find can now take an array of ids.
=== 1.1.2
- Fixing issues with updates to parents.
=== 1.1.1
- Document.create raises validations error, not no
method error on self.errors (Rick Frankel)
- Support default values that respond_to?(:call)
(procs/lambda) (ahoward)
- Added Mongoid.persist_in_safe_mode global config
option.
- Minor optimization: don't evaluate default procs
if it's not needed (brainopia)
=== 1.1.0
- Nil attributes no longer persist nil values to the
database - the field will just not exist.
- create! and save! will now properly raise an error
when a database operation fails. This is handled
by using :safe => true as an option to
collection.save.
- Setting blank numbers casts to nil.
- Criteria and named scopes can now be used on has
many relationships. They can be chained with each
other off the association chain.
- Mongoid can now determine if a document matches a
mongodb selector without hitting the database via
Document#matches?(selector).
- Overall performance improvements in all areas.
- Ruby 1.9 compatibility fixes.
- Has many related now supports finding by id or
by an optional :all, :first, :last with a
conditions hash.
=== 1.0.6
- Preventing the setting of empty values in attributes.
- Better inspect formatting
=== 1.0.5
- Has one and has many associations now set the parent
object first before writing the attributes on
#build and #create.
=== 1.0.4
- Modified criteria to use the querying class
when instantiating documents if there are no
subclasses.
- Floats that are empty strings or nil get
defaulted to 0.0
=== 1.0.3
- Small performance improvements on finders
- Float.set allows setting of non-numeric string
in order for validates_numericality_of to fail
properly.
=== 1.0.2
- Named scopes get added functionality:
- named scopes can now be criteria objects.
- named scoped can now be procs with criteria.
- named scopes and class methods that return
criteria can be chained with each other.
- When calling save on an embedded document whose
validation passes but the parent's validation
fails, it will properly return false.
=== 1.0.1
- Documents now have named_scopes similar to
ActiveRecord named scopes. Please see rdoc or
specs for examples.
- Document#to_json properly works in all cases.
- ActiveSupport calls for inflections have been
moved into the String::Inflections module.
- Updated dependency on Validatable to 2.0.1
=== 1.0.0
- Validations cleanup: Only before_validation and
after_validation callbacks are supported now.
- Dynamic fields have reader and writer methods
again, but only for instances where the dynamic
attribute exists.
- Lots of refactoring, mostly coverting common
fucntionality into modules for the upcoming rails
2 and 3 gem split.
=== 0.12.0
- Has one now works as expected:
- Has one associations will return nil, instead
of the proxy if the association has not been
set.
- Building/creating a has one is no longer handled
by calling the Document#association#build() or create(),
this is now handled by Document#build_name and
Document#create_name where "name" is the name
of the has one association.
- Passing a _type attribute to the #build_name
and #create_name methods will build/create
objects of that type, useful for creating
specific subclasses.
- The existing #build and #create methods will be
removed in the next release.
- Removed all dynamic finders. If you need to have
functionality similar to "find_or_(create|initialize)_by"
you can use the 2 new finders:
- Document.find_or_create_by(attributes): Will
look for a document in the database with the
supplied attributes, if found it will return the
document otherwise will create a new one with
the supplied attributes.
- Document.find_or_initialize_by(attributes): Will
look for a document in the database with the
supplied attributes, if found it will return the
document otherwise will instantiate a new one with
the supplied attributes.
- Fixed issue with empty hashes and arrays not getting
set on document instantiation.
=== 0.11.9
- Fixed issue with non-us time zones and formats
parsing incorrectly.
- Fixed error when specifying field restrictions
in criteria and not providing the _type. It
will now automaticall get added if it is not
present.
- Slight cleanup of delegated methods in Document.
- Dynamic attributes no longer create setters and
getters on the class. They can be accessed from
the attributes hash directly. If they are used
frequently it is preferrable to just add a field
to the class manually.
- Criteria#min no longer always returns 0.0.
=== 0.11.8
- Added #min and #max to criteria which takes a
single field argument.
=== 0.11.7
- Added #sum to criteria which takes a single field
to aggregate on. Example: Person.sum(:age) would
return a float that was the sum of all people's
ages in the db.
- Fixed issue with queries from parent classes always
casting the returned documents to the parent.
- Fixed singleton require issue.
- Group queries now run as db commands
=== 0.11.6
- Allow namespaced documents to default with:
"namespace_modelname"
- Fixed indexing of _type field to only happen on root
classes.
- Fixed creation of empty collections for embedded documents.
- Document.store_in now properly resets the collection
if the collection had already been accessed.
- Document.find(nil) now raises
Mongoid::Errors::InvalidOptions
=== 0.11.5
- Removed dependency on mongo_ext, since latest version
was breaking on various operating systems.
=== 0.11.4
- Fixed issue with dynamic fields: checking whether
the document responded to the attribute's method
should have checked the setter and not the getter
- Fixed has_one associations not being able to be
set to nil.
=== 0.11.3
- Fixed issue with Document#save! not calling before
and after create callbacks if document is new
=== 0.11.2
- Fixing bug where has many and has one relational
associations create method did not return the
associated document
=== 0.11.1
- Querying for classes that have subclasses will also
return the subclasses as well, similar to
ActiveRecord.
- Adding configuration option allow_dynamic_fields. This
defaults to true and if set to false will raise an
error when trying to set an attribute on an object
that does not have a corresponding field defined.
=== 0.11.0
- Set the collection name to store a document in via:
Document.store_in :collection_name
- Initial inheritance support:
- Documents and their associations can now have an
infinite number of subclasses.
- Has many and has one associations can build or
create specific subclasses by providing an optional
class as the last parameter to the #create and
#build methods on the respective associations.
- Querying for specific subclasses will only return
those documents which were saved as that subclass,
even though the hierarchy is stored in the same
collection.
- Deletion of subclass documents will only delete
documents of that type, even though they all exist
in the same collection. #delete_all and #destroy_all
also support this behavoir.
- Updated mongo and mongo_ext dependencies to 0.18.2
- Fixed save on new documents to return true instead
of the document itself.
=== 0.10.6
- Fixed bug when trying to set empty strings on number
fields. (TypeError: can't convert Fixnum into String)
- Document.delete_all now drops the collection if
conditions are empty or nil.
=== 0.10.5
- Documents that are embedded not properly respond to
Document#destroy and Document#delete.
- Documents can now be saved sans validation with
Document#save(false)
=== 0.10.4
- Documents no longer inherit from Mongoid::Document.
Please include Mongoid::Document in all your models now.
- Config module added, you can now set one option:
Mongoid.raise_not_found_error = (true|false)
- When set to false, a Mongoid::Errors::DocumentNotFound
will NOT get thrown when performing a Document.find(id)
that does not return a document from the database.
This defaults to true.
- Mongoid::Document.collection_name macro added. You can
now set the name of the database collection to persist to.
- Mongoid::Criteria#select becomes Mongoid::Criteria#only