mongoid 2.8.1 → 3.0.0.rc
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +802 -58
- data/LICENSE +1 -1
- data/README.md +10 -11
- data/Rakefile +2 -8
- data/lib/config/locales/en.yml +441 -51
- data/lib/mongoid.rb +24 -39
- data/lib/mongoid/atomic.rb +16 -33
- data/lib/mongoid/atomic/modifiers.rb +2 -2
- data/lib/mongoid/atomic/paths/embedded.rb +4 -5
- data/lib/mongoid/atomic/paths/embedded/many.rb +6 -6
- data/lib/mongoid/atomic/paths/embedded/one.rb +5 -5
- data/lib/mongoid/atomic/paths/root.rb +4 -5
- data/lib/mongoid/attributes.rb +95 -32
- data/lib/mongoid/attributes/processing.rb +14 -10
- data/lib/mongoid/attributes/readonly.rb +56 -0
- data/lib/mongoid/callbacks.rb +90 -27
- data/lib/mongoid/collections/retry.rb +2 -3
- data/lib/mongoid/components.rb +11 -23
- data/lib/mongoid/config.rb +87 -233
- data/lib/mongoid/config/environment.rb +5 -6
- data/lib/mongoid/config/inflections.rb +6 -0
- data/lib/mongoid/config/options.rb +1 -1
- data/lib/mongoid/config/validators.rb +3 -0
- data/lib/mongoid/config/validators/option.rb +25 -0
- data/lib/mongoid/config/validators/session.rb +140 -0
- data/lib/mongoid/contextual.rb +50 -0
- data/lib/mongoid/contextual/aggregable/memory.rb +98 -0
- data/lib/mongoid/contextual/aggregable/mongo.rb +181 -0
- data/lib/mongoid/contextual/atomic.rb +179 -0
- data/lib/mongoid/contextual/command.rb +43 -0
- data/lib/mongoid/contextual/find_and_modify.rb +66 -0
- data/lib/mongoid/contextual/map_reduce.rb +273 -0
- data/lib/mongoid/contextual/memory.rb +383 -0
- data/lib/mongoid/contextual/mongo.rb +543 -0
- data/lib/mongoid/copyable.rb +3 -34
- data/lib/mongoid/criteria.rb +436 -250
- data/lib/mongoid/criterion/inspection.rb +14 -8
- data/lib/mongoid/criterion/scoping.rb +114 -44
- data/lib/mongoid/dirty.rb +152 -67
- data/lib/mongoid/document.rb +69 -50
- data/lib/mongoid/errors.rb +22 -1
- data/lib/mongoid/errors/ambiguous_relationship.rb +51 -0
- data/lib/mongoid/errors/callback.rb +5 -6
- data/lib/mongoid/errors/delete_restriction.rb +29 -0
- data/lib/mongoid/errors/document_not_found.rb +98 -17
- data/lib/mongoid/errors/eager_load.rb +3 -6
- data/lib/mongoid/errors/invalid_collection.rb +3 -3
- data/lib/mongoid/errors/invalid_config_option.rb +27 -0
- data/lib/mongoid/errors/invalid_database.rb +3 -3
- data/lib/mongoid/errors/invalid_field.rb +54 -8
- data/lib/mongoid/errors/invalid_field_option.rb +35 -0
- data/lib/mongoid/errors/invalid_find.rb +3 -3
- data/lib/mongoid/errors/invalid_index.rb +28 -0
- data/lib/mongoid/errors/invalid_options.rb +4 -4
- data/lib/mongoid/errors/invalid_scope.rb +24 -0
- data/lib/mongoid/errors/invalid_set_polymorphic_relation.rb +38 -0
- data/lib/mongoid/errors/invalid_storage_options.rb +27 -0
- data/lib/mongoid/errors/invalid_time.rb +3 -6
- data/lib/mongoid/errors/inverse_not_found.rb +29 -0
- data/lib/mongoid/errors/mixed_relations.rb +4 -9
- data/lib/mongoid/errors/mixed_session_configuration.rb +28 -0
- data/lib/mongoid/errors/mongoid_error.rb +54 -3
- data/lib/mongoid/errors/nested_attributes_metadata_not_found.rb +28 -0
- data/lib/mongoid/errors/no_default_session.rb +23 -0
- data/lib/mongoid/errors/no_environment.rb +3 -3
- data/lib/mongoid/errors/no_map_reduce_output.rb +24 -0
- data/lib/mongoid/errors/no_parent.rb +24 -0
- data/lib/mongoid/errors/no_session_config.rb +22 -0
- data/lib/mongoid/errors/no_session_database.rb +27 -0
- data/lib/mongoid/errors/no_session_hosts.rb +27 -0
- data/lib/mongoid/errors/no_sessions_config.rb +20 -0
- data/lib/mongoid/errors/readonly_attribute.rb +25 -0
- data/lib/mongoid/errors/scope_overwrite.rb +4 -4
- data/lib/mongoid/errors/too_many_nested_attribute_records.rb +4 -4
- data/lib/mongoid/errors/unknown_attribute.rb +25 -0
- data/lib/mongoid/errors/unsaved_document.rb +4 -8
- data/lib/mongoid/errors/unsupported_javascript.rb +27 -0
- data/lib/mongoid/errors/unsupported_version.rb +4 -4
- data/lib/mongoid/errors/validations.rb +7 -6
- data/lib/mongoid/errors/versioning_not_on_root.rb +23 -0
- data/lib/mongoid/extensions.rb +28 -76
- data/lib/mongoid/extensions/array.rb +127 -0
- data/lib/mongoid/extensions/big_decimal.rb +42 -0
- data/lib/mongoid/extensions/boolean.rb +24 -0
- data/lib/mongoid/extensions/date.rb +70 -0
- data/lib/mongoid/extensions/date_time.rb +68 -0
- data/lib/mongoid/extensions/false_class.rb +26 -0
- data/lib/mongoid/extensions/float.rb +44 -0
- data/lib/mongoid/extensions/hash.rb +91 -0
- data/lib/mongoid/extensions/integer.rb +54 -0
- data/lib/mongoid/extensions/module.rb +28 -0
- data/lib/mongoid/extensions/nil_class.rb +21 -0
- data/lib/mongoid/extensions/object.rb +188 -0
- data/lib/mongoid/extensions/object_id.rb +53 -0
- data/lib/mongoid/extensions/range.rb +55 -0
- data/lib/mongoid/extensions/regexp.rb +27 -0
- data/lib/mongoid/extensions/set.rb +55 -0
- data/lib/mongoid/extensions/string.rb +155 -0
- data/lib/mongoid/extensions/symbol.rb +54 -0
- data/lib/mongoid/extensions/time.rb +78 -0
- data/lib/mongoid/extensions/time_with_zone.rb +55 -0
- data/lib/mongoid/extensions/true_class.rb +26 -0
- data/lib/mongoid/factory.rb +1 -1
- data/lib/mongoid/fields.rb +129 -194
- data/lib/mongoid/fields/foreign_key.rb +134 -0
- data/lib/mongoid/fields/localized.rb +73 -0
- data/lib/mongoid/fields/standard.rb +268 -0
- data/lib/mongoid/fields/validators.rb +2 -0
- data/lib/mongoid/fields/validators/macro.rb +83 -0
- data/lib/mongoid/finders.rb +42 -43
- data/lib/mongoid/hierarchy.rb +25 -14
- data/lib/mongoid/identity_map.rb +31 -19
- data/lib/mongoid/indexes.rb +66 -15
- data/lib/mongoid/indexes/validators/options.rb +80 -0
- data/lib/mongoid/inspection.rb +1 -1
- data/lib/mongoid/javascript.rb +1 -1
- data/lib/mongoid/json.rb +2 -2
- data/lib/mongoid/loggable.rb +69 -0
- data/lib/mongoid/matchers.rb +1 -1
- data/lib/mongoid/matchers/all.rb +7 -8
- data/lib/mongoid/matchers/and.rb +3 -3
- data/lib/mongoid/matchers/default.rb +6 -4
- data/lib/mongoid/matchers/exists.rb +2 -2
- data/lib/mongoid/matchers/gt.rb +2 -2
- data/lib/mongoid/matchers/gte.rb +2 -2
- data/lib/mongoid/matchers/in.rb +3 -7
- data/lib/mongoid/matchers/lt.rb +2 -2
- data/lib/mongoid/matchers/lte.rb +2 -2
- data/lib/mongoid/matchers/ne.rb +2 -2
- data/lib/mongoid/matchers/nin.rb +2 -2
- data/lib/mongoid/matchers/or.rb +2 -2
- data/lib/mongoid/matchers/size.rb +2 -2
- data/lib/mongoid/matchers/strategies.rb +3 -3
- data/lib/mongoid/multi_parameter_attributes.rb +8 -10
- data/lib/mongoid/nested_attributes.rb +17 -9
- data/lib/mongoid/observer.rb +1 -2
- data/lib/mongoid/paranoia.rb +13 -18
- data/lib/mongoid/persistence.rb +43 -39
- data/lib/mongoid/persistence/atomic.rb +2 -2
- data/lib/mongoid/persistence/atomic/add_to_set.rb +5 -9
- data/lib/mongoid/persistence/atomic/bit.rb +5 -7
- data/lib/mongoid/persistence/atomic/inc.rb +5 -7
- data/lib/mongoid/persistence/atomic/operation.rb +45 -6
- data/lib/mongoid/persistence/atomic/pop.rb +5 -7
- data/lib/mongoid/persistence/atomic/pull.rb +5 -7
- data/lib/mongoid/persistence/atomic/pull_all.rb +5 -7
- data/lib/mongoid/persistence/atomic/push.rb +4 -10
- data/lib/mongoid/persistence/atomic/push_all.rb +4 -10
- data/lib/mongoid/persistence/atomic/rename.rb +6 -7
- data/lib/mongoid/persistence/atomic/sets.rb +5 -7
- data/lib/mongoid/persistence/atomic/unset.rb +4 -5
- data/lib/mongoid/persistence/deletion.rb +2 -2
- data/lib/mongoid/persistence/insertion.rb +10 -16
- data/lib/mongoid/persistence/modification.rb +5 -9
- data/lib/mongoid/persistence/operations.rb +6 -19
- data/lib/mongoid/persistence/operations/embedded/insert.rb +7 -6
- data/lib/mongoid/persistence/operations/embedded/remove.rb +5 -5
- data/lib/mongoid/persistence/operations/insert.rb +4 -4
- data/lib/mongoid/persistence/operations/remove.rb +4 -4
- data/lib/mongoid/persistence/operations/update.rb +5 -5
- data/lib/mongoid/railtie.rb +26 -11
- data/lib/mongoid/railties/database.rake +22 -108
- data/lib/mongoid/relations.rb +4 -6
- data/lib/mongoid/relations/accessors.rb +119 -19
- data/lib/mongoid/relations/auto_save.rb +59 -5
- data/lib/mongoid/relations/binding.rb +211 -2
- data/lib/mongoid/relations/bindings/embedded/in.rb +16 -22
- data/lib/mongoid/relations/bindings/embedded/many.rb +9 -50
- data/lib/mongoid/relations/bindings/embedded/one.rb +10 -16
- data/lib/mongoid/relations/bindings/referenced/in.rb +31 -57
- data/lib/mongoid/relations/bindings/referenced/many.rb +8 -20
- data/lib/mongoid/relations/bindings/referenced/many_to_many.rb +15 -19
- data/lib/mongoid/relations/bindings/referenced/one.rb +10 -24
- data/lib/mongoid/relations/builder.rb +3 -3
- data/lib/mongoid/relations/builders.rb +19 -16
- data/lib/mongoid/relations/builders/embedded/in.rb +5 -5
- data/lib/mongoid/relations/builders/embedded/many.rb +12 -12
- data/lib/mongoid/relations/builders/embedded/one.rb +6 -6
- data/lib/mongoid/relations/builders/nested_attributes/many.rb +8 -8
- data/lib/mongoid/relations/builders/nested_attributes/one.rb +4 -4
- data/lib/mongoid/relations/builders/referenced/in.rb +4 -4
- data/lib/mongoid/relations/builders/referenced/many.rb +5 -5
- data/lib/mongoid/relations/builders/referenced/many_to_many.rb +7 -5
- data/lib/mongoid/relations/builders/referenced/one.rb +5 -5
- data/lib/mongoid/relations/cascading.rb +6 -4
- data/lib/mongoid/relations/cascading/delete.rb +3 -5
- data/lib/mongoid/relations/cascading/destroy.rb +3 -3
- data/lib/mongoid/relations/cascading/nullify.rb +3 -3
- data/lib/mongoid/relations/cascading/restrict.rb +37 -0
- data/lib/mongoid/relations/constraint.rb +4 -3
- data/lib/mongoid/relations/conversions.rb +5 -6
- data/lib/mongoid/relations/cyclic.rb +7 -7
- data/lib/mongoid/relations/embedded/batchable.rb +346 -0
- data/lib/mongoid/relations/embedded/in.rb +23 -12
- data/lib/mongoid/relations/embedded/many.rb +99 -161
- data/lib/mongoid/relations/embedded/one.rb +25 -14
- data/lib/mongoid/relations/macros.rb +105 -61
- data/lib/mongoid/relations/many.rb +93 -14
- data/lib/mongoid/relations/metadata.rb +200 -45
- data/lib/mongoid/relations/nested_builder.rb +3 -5
- data/lib/mongoid/relations/one.rb +2 -2
- data/lib/mongoid/relations/options.rb +2 -2
- data/lib/mongoid/relations/polymorphic.rb +9 -9
- data/lib/mongoid/relations/proxy.rb +60 -31
- data/lib/mongoid/relations/referenced/in.rb +40 -15
- data/lib/mongoid/relations/referenced/many.rb +117 -132
- data/lib/mongoid/relations/referenced/many_to_many.rb +101 -46
- data/lib/mongoid/relations/referenced/one.rb +34 -13
- data/lib/mongoid/relations/reflections.rb +3 -3
- data/lib/mongoid/relations/synchronization.rb +19 -23
- data/lib/mongoid/relations/targets/enumerable.rb +86 -57
- data/lib/mongoid/reloading.rb +12 -14
- data/lib/mongoid/scoping.rb +329 -0
- data/lib/mongoid/serialization.rb +8 -27
- data/lib/mongoid/sessions.rb +359 -0
- data/lib/mongoid/sessions/factory.rb +106 -0
- data/lib/mongoid/sessions/mongo_uri.rb +93 -0
- data/lib/mongoid/sessions/validators.rb +2 -0
- data/lib/mongoid/sessions/validators/storage.rb +49 -0
- data/lib/mongoid/sharding.rb +6 -6
- data/lib/mongoid/state.rb +6 -7
- data/lib/mongoid/threaded.rb +167 -59
- data/lib/mongoid/threaded/lifecycle.rb +21 -22
- data/lib/mongoid/threaded/sessions.rb +0 -0
- data/lib/mongoid/timestamps.rb +1 -1
- data/lib/mongoid/timestamps/created.rb +8 -4
- data/lib/mongoid/timestamps/timeless.rb +6 -4
- data/lib/mongoid/timestamps/updated.rb +3 -3
- data/lib/mongoid/unit_of_work.rb +61 -0
- data/lib/mongoid/validations.rb +27 -19
- data/lib/mongoid/validations/associated.rb +2 -2
- data/lib/mongoid/validations/format.rb +2 -2
- data/lib/mongoid/validations/presence.rb +31 -5
- data/lib/mongoid/validations/uniqueness.rb +9 -12
- data/lib/mongoid/version.rb +2 -2
- data/lib/mongoid/versioning.rb +25 -26
- data/lib/rack/mongoid/middleware/identity_map.rb +3 -3
- data/lib/rails/generators/mongoid/config/config_generator.rb +1 -1
- data/lib/rails/generators/mongoid/config/templates/mongoid.yml +59 -19
- data/lib/rails/generators/mongoid/model/model_generator.rb +7 -7
- data/lib/rails/generators/mongoid/model/templates/model.rb.tt +2 -2
- data/lib/rails/generators/mongoid/observer/observer_generator.rb +4 -4
- data/lib/rails/generators/mongoid_generator.rb +5 -5
- data/lib/rails/mongoid.rb +69 -25
- metadata +110 -137
- checksums.yaml +0 -7
- data/lib/config/locales/bg.yml +0 -61
- data/lib/config/locales/de.yml +0 -61
- data/lib/config/locales/en-GB.yml +0 -64
- data/lib/config/locales/es.yml +0 -59
- data/lib/config/locales/fr.yml +0 -62
- data/lib/config/locales/hi.yml +0 -53
- data/lib/config/locales/hu.yml +0 -64
- data/lib/config/locales/id.yml +0 -62
- data/lib/config/locales/it.yml +0 -59
- data/lib/config/locales/ja.yml +0 -57
- data/lib/config/locales/kr.yml +0 -54
- data/lib/config/locales/nl.yml +0 -61
- data/lib/config/locales/pl.yml +0 -59
- data/lib/config/locales/pt-BR.yml +0 -60
- data/lib/config/locales/pt.yml +0 -60
- data/lib/config/locales/ro.yml +0 -66
- data/lib/config/locales/ru.yml +0 -61
- data/lib/config/locales/sv.yml +0 -60
- data/lib/config/locales/vi.yml +0 -62
- data/lib/config/locales/zh-CN.yml +0 -53
- data/lib/mongoid/collection.rb +0 -157
- data/lib/mongoid/collections.rb +0 -120
- data/lib/mongoid/collections/master.rb +0 -45
- data/lib/mongoid/collections/operations.rb +0 -44
- data/lib/mongoid/config/database.rb +0 -181
- data/lib/mongoid/config/replset_database.rb +0 -80
- data/lib/mongoid/contexts.rb +0 -25
- data/lib/mongoid/contexts/enumerable.rb +0 -313
- data/lib/mongoid/contexts/enumerable/sort.rb +0 -43
- data/lib/mongoid/contexts/mongo.rb +0 -487
- data/lib/mongoid/criterion/builder.rb +0 -34
- data/lib/mongoid/criterion/complex.rb +0 -84
- data/lib/mongoid/criterion/creational.rb +0 -34
- data/lib/mongoid/criterion/exclusion.rb +0 -110
- data/lib/mongoid/criterion/inclusion.rb +0 -290
- data/lib/mongoid/criterion/optional.rb +0 -259
- data/lib/mongoid/criterion/selector.rb +0 -177
- data/lib/mongoid/cursor.rb +0 -88
- data/lib/mongoid/default_scope.rb +0 -36
- data/lib/mongoid/errors/invalid_type.rb +0 -25
- data/lib/mongoid/extensions/array/deep_copy.rb +0 -25
- data/lib/mongoid/extensions/array/deletion.rb +0 -29
- data/lib/mongoid/extensions/false_class/equality.rb +0 -26
- data/lib/mongoid/extensions/hash/criteria_helpers.rb +0 -47
- data/lib/mongoid/extensions/hash/deep_copy.rb +0 -25
- data/lib/mongoid/extensions/hash/scoping.rb +0 -25
- data/lib/mongoid/extensions/integer/checks.rb +0 -23
- data/lib/mongoid/extensions/nil/collectionization.rb +0 -23
- data/lib/mongoid/extensions/object/checks.rb +0 -29
- data/lib/mongoid/extensions/object/deep_copy.rb +0 -21
- data/lib/mongoid/extensions/object/reflections.rb +0 -48
- data/lib/mongoid/extensions/object/substitutable.rb +0 -15
- data/lib/mongoid/extensions/object/yoda.rb +0 -44
- data/lib/mongoid/extensions/object_id/conversions.rb +0 -60
- data/lib/mongoid/extensions/proc/scoping.rb +0 -25
- data/lib/mongoid/extensions/string/checks.rb +0 -36
- data/lib/mongoid/extensions/string/conversions.rb +0 -22
- data/lib/mongoid/extensions/string/inflections.rb +0 -118
- data/lib/mongoid/extensions/symbol/checks.rb +0 -23
- data/lib/mongoid/extensions/symbol/inflections.rb +0 -67
- data/lib/mongoid/extensions/true_class/equality.rb +0 -26
- data/lib/mongoid/extras.rb +0 -31
- data/lib/mongoid/fields/internal/array.rb +0 -77
- data/lib/mongoid/fields/internal/big_decimal.rb +0 -63
- data/lib/mongoid/fields/internal/bignum.rb +0 -10
- data/lib/mongoid/fields/internal/binary.rb +0 -11
- data/lib/mongoid/fields/internal/boolean.rb +0 -58
- data/lib/mongoid/fields/internal/date.rb +0 -51
- data/lib/mongoid/fields/internal/date_time.rb +0 -28
- data/lib/mongoid/fields/internal/false_class.rb +0 -10
- data/lib/mongoid/fields/internal/fixnum.rb +0 -10
- data/lib/mongoid/fields/internal/float.rb +0 -47
- data/lib/mongoid/fields/internal/foreign_keys/array.rb +0 -88
- data/lib/mongoid/fields/internal/foreign_keys/object.rb +0 -56
- data/lib/mongoid/fields/internal/hash.rb +0 -11
- data/lib/mongoid/fields/internal/integer.rb +0 -59
- data/lib/mongoid/fields/internal/localized.rb +0 -62
- data/lib/mongoid/fields/internal/nil_class.rb +0 -53
- data/lib/mongoid/fields/internal/object.rb +0 -11
- data/lib/mongoid/fields/internal/object_id.rb +0 -46
- data/lib/mongoid/fields/internal/range.rb +0 -61
- data/lib/mongoid/fields/internal/set.rb +0 -57
- data/lib/mongoid/fields/internal/string.rb +0 -42
- data/lib/mongoid/fields/internal/symbol.rb +0 -43
- data/lib/mongoid/fields/internal/time.rb +0 -23
- data/lib/mongoid/fields/internal/time_with_zone.rb +0 -23
- data/lib/mongoid/fields/internal/timekeeping.rb +0 -122
- data/lib/mongoid/fields/internal/true_class.rb +0 -10
- data/lib/mongoid/fields/mappings.rb +0 -42
- data/lib/mongoid/fields/serializable.rb +0 -270
- data/lib/mongoid/identity.rb +0 -92
- data/lib/mongoid/keys.rb +0 -144
- data/lib/mongoid/logger.rb +0 -45
- data/lib/mongoid/multi_database.rb +0 -36
- data/lib/mongoid/named_scope.rb +0 -166
- data/lib/mongoid/relations/embedded/atomic.rb +0 -89
- data/lib/mongoid/relations/embedded/atomic/operation.rb +0 -63
- data/lib/mongoid/relations/embedded/atomic/pull.rb +0 -65
- data/lib/mongoid/relations/embedded/atomic/push_all.rb +0 -59
- data/lib/mongoid/relations/embedded/atomic/set.rb +0 -61
- data/lib/mongoid/relations/embedded/atomic/unset.rb +0 -41
- data/lib/mongoid/relations/referenced/batch.rb +0 -73
- data/lib/mongoid/relations/referenced/batch/insert.rb +0 -57
- data/lib/mongoid/safety.rb +0 -105
- data/lib/mongoid/scope.rb +0 -31
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
|
1
|
+
Mongoid [![Build Status](https://secure.travis-ci.org/mongoid/mongoid.png?branch=master&.png)](http://travis-ci.org/mongoid/mongoid)
|
2
2
|
========
|
3
3
|
|
4
|
-
About Mongoid
|
5
|
-
-------------
|
6
|
-
|
7
4
|
Mongoid is an ODM (Object-Document-Mapper) framework for MongoDB in Ruby.
|
8
5
|
|
9
6
|
Project Tracking
|
@@ -15,11 +12,7 @@ Project Tracking
|
|
15
12
|
Compatibility
|
16
13
|
-------------
|
17
14
|
|
18
|
-
Mongoid is tested against
|
19
|
-
|
20
|
-
<img src="https://secure.travis-ci.org/mongoid/mongoid.png?branch=master&.png"/>
|
21
|
-
|
22
|
-
[Build History](http://travis-ci.org/mongoid/mongoid)
|
15
|
+
Mongoid is tested against MRI 1.9.2, 1.9.3, 2.0.0, and JRuby (1.9).
|
23
16
|
|
24
17
|
Documentation
|
25
18
|
-------------
|
@@ -30,12 +23,18 @@ Please see the new Mongoid website for up-to-date documentation:
|
|
30
23
|
Donating
|
31
24
|
--------
|
32
25
|
|
33
|
-
|
26
|
+
[Support Mongoid at Pledgie](http://www.pledgie.com/campaigns/7757)
|
27
|
+
|
28
|
+
<a href='http://www.pledgie.com/campaigns/7757'>
|
29
|
+
<img alt='Click here to lend your support to: Mongoid and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/7757.png?skin_name=chrome' border='0'/>
|
30
|
+
</a>
|
31
|
+
|
32
|
+
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=durran&url=http://github.com/mongoid&title=mongoid&language=&tags=github&category=software)
|
34
33
|
|
35
34
|
License
|
36
35
|
-------
|
37
36
|
|
38
|
-
Copyright (c) 2009
|
37
|
+
Copyright (c) 2009-2012 Durran Jordan
|
39
38
|
|
40
39
|
Permission is hereby granted, free of charge, to any person obtaining
|
41
40
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -2,7 +2,6 @@ require "bundler"
|
|
2
2
|
Bundler.setup
|
3
3
|
|
4
4
|
require "rake"
|
5
|
-
require "rspec"
|
6
5
|
require "rspec/core/rake_task"
|
7
6
|
|
8
7
|
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
@@ -23,12 +22,8 @@ task :release => :build do
|
|
23
22
|
system "gem push mongoid-#{Mongoid::VERSION}.gem"
|
24
23
|
end
|
25
24
|
|
26
|
-
RSpec::Core::RakeTask.new("spec
|
27
|
-
spec.pattern = "spec
|
28
|
-
end
|
29
|
-
|
30
|
-
RSpec::Core::RakeTask.new("spec:functional") do |spec|
|
31
|
-
spec.pattern = "spec/functional/**/*_spec.rb"
|
25
|
+
RSpec::Core::RakeTask.new("spec") do |spec|
|
26
|
+
spec.pattern = "spec/**/*_spec.rb"
|
32
27
|
end
|
33
28
|
|
34
29
|
RSpec::Core::RakeTask.new('spec:progress') do |spec|
|
@@ -36,5 +31,4 @@ RSpec::Core::RakeTask.new('spec:progress') do |spec|
|
|
36
31
|
spec.pattern = "spec/**/*_spec.rb"
|
37
32
|
end
|
38
33
|
|
39
|
-
task :spec => [ "spec:functional", "spec:unit" ]
|
40
34
|
task :default => :spec
|
data/lib/config/locales/en.yml
CHANGED
@@ -1,64 +1,454 @@
|
|
1
1
|
en:
|
2
2
|
mongoid:
|
3
|
+
inspection:
|
4
|
+
criteria: "#<Mongoid::Criteria\n
|
5
|
+
\_\_selector: %{selector},\n
|
6
|
+
\_\_options: %{options},\n
|
7
|
+
\_\_class: %{klass},\n
|
8
|
+
\_\_embedded: %{embedded}>\n"
|
9
|
+
metadata: "#<Mongoid::Relations::Metadata\n
|
10
|
+
\_\_autobuild: %{autobuild},\n
|
11
|
+
\_\_class_name: %{class_name},\n
|
12
|
+
\_\_cyclic: %{cyclic},\n
|
13
|
+
\_\_dependent: %{dependent},\n
|
14
|
+
\_\_inverse_of: %{inverse_of},\n
|
15
|
+
\_\_key: %{key},\n
|
16
|
+
\_\_macro: %{macro},\n
|
17
|
+
\_\_name: %{name},\n
|
18
|
+
\_\_order: %{order},\n
|
19
|
+
\_\_polymorphic: %{polymorphic},\n
|
20
|
+
\_\_relation: %{relation},\n
|
21
|
+
\_\_setter: %{setter},\n
|
22
|
+
\_\_versioned: %{versioned}>\n"
|
3
23
|
errors:
|
4
24
|
messages:
|
5
25
|
blank:
|
6
|
-
can't be blank
|
7
|
-
|
8
|
-
|
26
|
+
"can't be blank"
|
27
|
+
blank_in_locale:
|
28
|
+
"can't be blank in %{location}"
|
29
|
+
ambiguous_relationship:
|
30
|
+
message: "Ambiguous relations %{candidates} defined on %{klass}."
|
31
|
+
summary:
|
32
|
+
"When Mongoid attempts to set an inverse document of a relation
|
33
|
+
in memory, it needs to know which relation it belongs to. When
|
34
|
+
setting %{name}, Mongoid looked on the class %{inverse}
|
35
|
+
for a matching relation, but multiples were found that could
|
36
|
+
potentially match: %{candidates}."
|
37
|
+
resolution: "On the %{name} relation on %{inverse} you must add an
|
38
|
+
:inverse_of option to specify the exact relationship on %{klass}
|
39
|
+
that is the opposite of %{name}."
|
9
40
|
callbacks:
|
10
|
-
"Calling %{method} on %{klass} resulted in a false return
|
41
|
+
message: "Calling %{method} on %{klass} resulted in a false return
|
42
|
+
from a callback."
|
43
|
+
summary: "If a before callback returns false when using Document.create!,
|
44
|
+
Document#save!, or Documnet#update_attributes! this error will get raised
|
45
|
+
since the document did not actually get saved."
|
46
|
+
resolution: "Double check all before callbacks to make sure they are
|
47
|
+
not unintentionally returning false."
|
48
|
+
calling_document_find_with_nil_is_invalid:
|
49
|
+
message: "Calling Document.find with nil is invalid."
|
50
|
+
summary: "Document.find expects the parameters to be 1 or more ids, and
|
51
|
+
will return a single document if 1 id is provided, otherwise an array
|
52
|
+
of documents if multiple ids are provided."
|
53
|
+
resolution: "Most likely this is caused by passing parameters directly
|
54
|
+
through to the find, and the parameter either is not present or the
|
55
|
+
key from which it is accessed is incorrect."
|
11
56
|
document_not_found:
|
12
|
-
Document not found for class %{klass} with id(s) %{
|
57
|
+
message: "Document(s) not found for class %{klass} with id(s) %{missing}."
|
58
|
+
summary: "When calling %{klass}.find with an id or array of ids, each
|
59
|
+
parameter must match a document in the database or this error will be
|
60
|
+
raised. The search was for the id(s): %{searched} (%{total} total)
|
61
|
+
and the following ids were not found: %{missing}."
|
62
|
+
resolution: "Search for an id that is in the database or set
|
63
|
+
the Mongoid.raise_not_found_error configuration option to false,
|
64
|
+
which will cause a nil to be returned instead of raising this error when
|
65
|
+
searching for a single id, or only the matched documents when searching
|
66
|
+
for multiples."
|
67
|
+
document_with_attributes_not_found:
|
68
|
+
message: "Document not found for class %{klass} with attributes %{attributes}."
|
69
|
+
summary: "When calling %{klass}.find_by with a hash of attributes, all
|
70
|
+
attributes provided must match a document in the database of this error
|
71
|
+
will be raised."
|
72
|
+
resolution: "Search for attributes that are in the database or set
|
73
|
+
the Mongoid.raise_not_found_error configuration option to false,
|
74
|
+
which will cause a nil to be returned instead of raising this error."
|
13
75
|
eager_load:
|
14
|
-
"Eager loading :%{name} is not supported
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
"'
|
20
|
-
|
21
|
-
"Invalid option :%{invalid} provided to relation :%{name}. Valid options
|
22
|
-
are: %{valid}."
|
23
|
-
invalid_type:
|
24
|
-
Field was defined as a(n) %{klass}, but received a %{other} with
|
25
|
-
the value %{value}.
|
26
|
-
unsupported_version:
|
27
|
-
MongoDB %{version} not supported, please upgrade
|
28
|
-
to %{mongo_version}.
|
29
|
-
validations:
|
30
|
-
Validation failed - %{errors}.
|
76
|
+
message: "Eager loading :%{name} is not supported since it is a
|
77
|
+
polymorphic belongs_to relation."
|
78
|
+
summary: "Mongoid cannot currently determine the classes it needs to
|
79
|
+
eager load when the relation is polymorphic. The parents reside in
|
80
|
+
different collections so a simple id lookup is not sufficient enough."
|
81
|
+
resolution: "Don't attempt to perform this action and have patience,
|
82
|
+
maybe this will be supported in the future."
|
31
83
|
invalid_collection:
|
32
|
-
Access to the collection for %{klass} is not allowed
|
33
|
-
|
34
|
-
|
84
|
+
message: "Access to the collection for %{klass} is not allowed."
|
85
|
+
summary: "%{klass}.collection was called, and %{klass} is an embedded
|
86
|
+
document - it resides within the collection of the root document of
|
87
|
+
the hierarchy."
|
88
|
+
resolution: "For access to the collection that the embedded document is
|
89
|
+
in, use %{klass}#_root.collection, or do not attempt to persist an
|
90
|
+
embedded document without a parent set."
|
91
|
+
invalid_config_option:
|
92
|
+
message: "Invalid configuration option: %{name}."
|
93
|
+
summary: "A invalid configuration option was provided in your
|
94
|
+
mongoid.yml, or a typo is potentially present. The valid configuration
|
95
|
+
options are: %{options}."
|
96
|
+
resolution: "Remove the invalid option or fix the typo. If you were
|
97
|
+
expecting the option to be there, please consult the following page
|
98
|
+
with repect to Mongoid's configuration:\n\n
|
99
|
+
\_\_http://mongoid.org/docs/installation.html"
|
100
|
+
invalid_database:
|
101
|
+
message: "Database should be a Mongo::DB, not %{name}."
|
102
|
+
summary: "When setting a master database in the Mongoid configuration
|
103
|
+
it must be an actual instance of a Mongo::DB, and not just a name
|
104
|
+
of the database. This check is performed when calling
|
105
|
+
Mongoid.master = object."
|
106
|
+
resolution: "Make sure that when setting the configuration
|
107
|
+
programatically that you are passing an actual db instance."
|
35
108
|
invalid_field:
|
36
|
-
Defining a field named %{name} is not allowed.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
109
|
+
message: "Defining a field named '%{name}' is not allowed."
|
110
|
+
summary: "Defining this field would override the method '%{name}',
|
111
|
+
which would cause issues with expectations around the original
|
112
|
+
method and cause extremely hard to debug issues. The original
|
113
|
+
method was defined in:\n
|
114
|
+
\_\_Object: %{origin}\n
|
115
|
+
\_\_File: %{file}\n
|
116
|
+
\_\_Line: %{line}"
|
117
|
+
resolution: "Use Mongoid.destructive_fields to see what names are not
|
118
|
+
allowed, and don't use these names. These include names that also
|
119
|
+
conflict with core Ruby methods on Object, Module, Enumerable, or
|
120
|
+
included gems that inject methods into these or Mongoid internals."
|
121
|
+
invalid_field_option:
|
122
|
+
message: "Invalid option :%{option} provided for field :%{name}."
|
123
|
+
summary: "Mongoid requires that you only provide valid options on each
|
124
|
+
field definition in order to prevent unexpected behaviour later on."
|
125
|
+
resolution: "When defining the field :%{name} on '%{klass}', please provide
|
126
|
+
valid options for the field. These are currently: %{valid}. If you
|
127
|
+
meant to define a custom field option, please do so first like so:\n\n
|
128
|
+
\_\_Mongoid::Fields.option :%{option} do |model, field, value|\n
|
129
|
+
\_\_\_\_# Your logic here...\n
|
130
|
+
\_\_end\n
|
131
|
+
\_\_class %{klass}\n
|
132
|
+
\_\_\_\_include Mongoid::Document\n
|
133
|
+
\_\_\_\_field :%{name}, %{option}: true\n
|
134
|
+
\_\_end\n\n"
|
135
|
+
invalid_index:
|
136
|
+
message: "Invalid index specification on %{klass}: %{spec}, %{options}"
|
137
|
+
summary: "Indexes in Mongoid are defined as a hash of field name and
|
138
|
+
direction/2d pairs, with a hash for any additional options."
|
139
|
+
resolution: "Ensure that the index conforms to the correct syntax and
|
140
|
+
has the correct options.\n\n
|
141
|
+
Valid options are:\n
|
142
|
+
\_\_background: true|false\n
|
143
|
+
\_\_drop_dups: true|false\n
|
144
|
+
\_\_name: 'index_name'\n
|
145
|
+
\_\_sparse: true|false\n
|
146
|
+
\_\_unique: true|false\n\n
|
147
|
+
Valid types are: 1, -1, '2d'\n\n
|
148
|
+
Example:\n
|
149
|
+
\_\_class Band\n
|
150
|
+
\_\_\_\_include Mongoid::Document\n
|
151
|
+
\_\_\_\_index({ name: 1, label: -1 }, { sparse: true })\n
|
152
|
+
\_\_\_\_index({ location: '2d' }, { background: true })\n
|
153
|
+
\_\_end\n\n"
|
154
|
+
invalid_options:
|
155
|
+
message: "Invalid option :%{invalid} provided to relation :%{name}."
|
156
|
+
summary: "Mongoid checks the options that are passed to the relation
|
157
|
+
macros to ensure that no ill side effects occur by letting something
|
158
|
+
slip by."
|
159
|
+
resolution: "Valid options are: %{valid}, make sure these are the ones
|
160
|
+
you are using."
|
161
|
+
invalid_scope:
|
162
|
+
message: "Defining a scope of value %{value} on %{klass} is not
|
163
|
+
allowed."
|
164
|
+
summary: "Scopes in Mongoid must be either criteria objects or procs
|
165
|
+
that wrap criteria objects."
|
166
|
+
resolution: "Change the scope to be a criteria or proc wrapped
|
167
|
+
critera.\n\n
|
168
|
+
Example:\n
|
169
|
+
\_\_class Band\n
|
170
|
+
\_\_\_\_include Mongoid::Document\n
|
171
|
+
\_\_\_\_field :active, type: Boolean, default: true\n
|
172
|
+
\_\_\_\_scope :active, where(active: true)\n
|
173
|
+
\_\_\_\_scope :inactive, ->{ where(active: false) }\n
|
174
|
+
\_\_end\n\n"
|
175
|
+
invalid_storage_options:
|
176
|
+
message: "Invalid options passed to %{klass}.store_in: %{options}."
|
177
|
+
summary: "The :store_in macro takes only a hash of parameters with
|
178
|
+
the keys :database, :collection, or :session."
|
179
|
+
resolution: "Change the options passed to store_in to match the
|
180
|
+
documented API, and ensure all keys in the options hash are
|
181
|
+
symbols.\n\n
|
182
|
+
Example:\n
|
183
|
+
\_\_class Band\n
|
184
|
+
\_\_\_\_include Mongoid::Document\n
|
185
|
+
\_\_\_\_store_in collection: 'artists', database: 'secondary'\n
|
186
|
+
\_\_end\n\n"
|
187
|
+
invalid_time:
|
188
|
+
message: "'%{value}' is not a valid Time."
|
189
|
+
summary: "Mongoid tries to serialize the values for Date, DateTime, and
|
190
|
+
Time into proper UTC times to store in the database. The provided
|
191
|
+
value could not be parsed."
|
192
|
+
resolution: "Make sure to pass parsable values to the field setter
|
193
|
+
for Date, DateTime, and Time objects. When this is a String it needs
|
194
|
+
to be valid for Time.parse. Other objects must be valid to pass to
|
195
|
+
Time.local."
|
196
|
+
inverse_not_found:
|
197
|
+
message: "When adding a(n) %{klass} to %{base}#%{name}, Mongoid could
|
198
|
+
not determine the inverse foreign key to set. The attempted key was
|
199
|
+
'%{inverse}'."
|
200
|
+
summary: "When adding a document to a relation, Mongoid attempts
|
201
|
+
to link the newly added document to the base of the relation in
|
202
|
+
memory, as well as set the foreign key to link them on the
|
203
|
+
database side. In this case Mongoid could not determine what the
|
204
|
+
inverse foreign key was."
|
205
|
+
resolution: "If an inverse is not required, like a belongs_to or
|
206
|
+
has_and_belongs_to_many, ensure that :inverse_of => nil is set
|
207
|
+
on the relation. If the inverse is needed, most likely the
|
208
|
+
inverse cannot be figured out from the names of the relations and
|
209
|
+
you will need to explicitly tell Mongoid on the relation what
|
210
|
+
the inverse is.\n\n
|
211
|
+
Example:\n
|
212
|
+
\_\_class Lush\n
|
213
|
+
\_\_\_\_include Mongoid::Document\n
|
214
|
+
\_\_\_\_has_one :whiskey, class_name: \"Drink\", inverse_of: :alcoholic\n
|
215
|
+
\_\_end\n\n
|
216
|
+
\_\_class Drink\n
|
217
|
+
\_\_\_\_include Mongoid::Document\n
|
218
|
+
\_\_\_\_belongs_to :alcoholic, class_name: \"Lush\", inverse_of: :whiskey\n
|
219
|
+
\_\_end"
|
220
|
+
invalid_set_polymorphic_relation:
|
221
|
+
message: "The %{name} attribute can't be set to an instance of
|
222
|
+
%{other_klass} as %{other_klass} has multiple relations referencing
|
223
|
+
%{klass} as %{name}."
|
224
|
+
summary: "If the parent class of a polymorphic relation has multiple
|
225
|
+
definitions for the same relation, the values must be set from the
|
226
|
+
parent side and not the child side since Mongoid cannot determine
|
227
|
+
from the child side which relation to go in."
|
228
|
+
resolution: "Set the values from the parent, or redefine the relation
|
229
|
+
with only a single definition in the parent."
|
55
230
|
mixed_relations:
|
56
|
-
Referencing a(n) %{embedded} document from the %{root}
|
57
|
-
|
231
|
+
message: "Referencing a(n) %{embedded} document from the %{root}
|
232
|
+
document via a relational association is not allowed since the
|
233
|
+
%{embedded} is embedded."
|
234
|
+
summary: "In order to properly access a(n) %{embedded} from %{root}
|
235
|
+
the reference would need to go through the root document of
|
236
|
+
%{embedded}. In a simple case this would require Mongoid to store
|
237
|
+
an extra foreign key for the root, in more complex cases where
|
238
|
+
%{embedded} is multiple levels deep a key would need to be stored
|
239
|
+
for each parent up the hierarchy."
|
240
|
+
resolution: "Consider not embedding %{embedded}, or do the key
|
241
|
+
storage and access in a custom manner in the application code."
|
242
|
+
mixed_session_configuration:
|
243
|
+
message: "Both uri and standard configuration options defined for
|
244
|
+
session: '%{name}'."
|
245
|
+
summary: "Instead of simply giving uri or standard options a
|
246
|
+
preference order, Mongoid assumes that you have made a mistake in
|
247
|
+
your configuration and requires that you provide one or the other,
|
248
|
+
but not both. The options that were provided were: %{config}."
|
249
|
+
resolution: "Provide either only a uri as configuration or only
|
250
|
+
standard options."
|
251
|
+
nested_attributes_metadata_not_found:
|
252
|
+
message: "Could not find metadata for relation '%{name}' on model:
|
253
|
+
%{klass}."
|
254
|
+
summary: "When defining nested attributes for a relation, Mongoid
|
255
|
+
needs to access the metadata for the relation '%{name}' in order
|
256
|
+
if add autosave functionality to it, if applicable. Either no
|
257
|
+
relation named '%{name}' could be found, or the relation had not
|
258
|
+
been defined yet."
|
259
|
+
resolution: "Make sure that there is a relation defined named
|
260
|
+
'%{name}' on %{klass} or that the relation definition comes before
|
261
|
+
the accepts_nested_attributes_for macro in the model - order
|
262
|
+
matters so that Mongoid has access to the metadata.\n\n
|
263
|
+
Example:\n
|
264
|
+
\_\_class Band\n
|
265
|
+
\_\_\_\_include Mongoid::Document\n
|
266
|
+
\_\_\_\_has_many :albums\n
|
267
|
+
\_\_\_\_accepts_nested_attributes_for :albums\n
|
268
|
+
\_\_end\n\n"
|
269
|
+
no_default_session:
|
270
|
+
message: "No default session configuration is defined."
|
271
|
+
summary: "The configuration provided settings for: %{keys}, but
|
272
|
+
Mongoid requires a :default to be defined at minimum."
|
273
|
+
resolution: "If configuring via a mongoid.yml, ensure that within
|
274
|
+
your :sessions section a :default session is defined.\n\n
|
275
|
+
Example:\n
|
276
|
+
\_\_development:\n
|
277
|
+
\_\_\_\_sessions:\n
|
278
|
+
\_\_\_\_\_\_default:\n
|
279
|
+
\_\_\_\_\_\_\_\_hosts:\n
|
280
|
+
\_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
|
58
281
|
no_environment:
|
59
|
-
"
|
60
|
-
|
282
|
+
message: "Could not load the configuration since no environment
|
283
|
+
was defined."
|
284
|
+
summary: "Mongoid attempted to find the appropriate environment
|
285
|
+
but no Rails.env, Sinatra::Base.environment, RACK_ENV, or
|
286
|
+
MONGOID_ENV could be found."
|
287
|
+
resolution: "Make sure some environment is set from the mentioned
|
288
|
+
options. Mongoid cannot load configuration from the yaml without
|
289
|
+
knowing which environment it is in, and we have considered
|
290
|
+
defaulting to development an undesireable side effect of this not
|
291
|
+
being defined."
|
292
|
+
no_map_reduce_output:
|
293
|
+
message: "No output location was specified for the map/reduce
|
294
|
+
operation."
|
295
|
+
summary: "When executing a map/reduce, you must provide the output
|
296
|
+
location of the results. The attempted command was: %{command}."
|
297
|
+
resolution: "Provide the location that the output of the operation
|
298
|
+
is to go by chaining an #out call to the map/reduce.\n\n
|
299
|
+
Example:\n
|
300
|
+
\_\_Band.map_reduce(map, reduce).out(inline: 1)\n\n
|
301
|
+
Valid options for the out function are:\n
|
302
|
+
\_\_inline: 1\n
|
303
|
+
\_\_merge: 'collection-name'\n
|
304
|
+
\_\_replace: 'collection-name'\n
|
305
|
+
\_\_reduce: 'collection-name'\n\n"
|
306
|
+
no_parent:
|
307
|
+
message: "Cannot persist embedded document %{klass} without a
|
308
|
+
parent document."
|
309
|
+
summary: "If the document is embedded, in order to be persisted it
|
310
|
+
must always have a reference to it's parent document. This is
|
311
|
+
most likely cause by either calling %{klass}.create or
|
312
|
+
%{klass}.create! without setting the parent document as an
|
313
|
+
attribute."
|
314
|
+
resolution: "Ensure that you've set the parent relation if
|
315
|
+
instantiating the embedded document direcly, or always create new
|
316
|
+
embedded documents via the parent relation."
|
317
|
+
no_session_config:
|
318
|
+
message: "No configuration could be found for a session named
|
319
|
+
'%{name}'."
|
320
|
+
summary: "When attempting to create the new session, Mongoid could
|
321
|
+
not find a session configuration for the name: '%{name}'. This is
|
322
|
+
necessary in order to know the host, port, and options needed
|
323
|
+
to connect."
|
324
|
+
resolution: "Double check your mongoid.yml to make sure under the
|
325
|
+
sessions key that a configuration exists for '%{name}'. If you
|
326
|
+
have set the configuration programatically, ensure that '%{name}'
|
327
|
+
exists in the configuration hash."
|
328
|
+
no_sessions_config:
|
329
|
+
message: "No sessions configuration provided."
|
330
|
+
summary: "Mongoid's configuration requires that you provide details
|
331
|
+
about each session that can be connected to, and requires in
|
332
|
+
the sessions config at least 1 default session to exist."
|
333
|
+
resolution: "Double check your mongoid.yml to make sure that you
|
334
|
+
have a top-level sessions key with at least 1 default session
|
335
|
+
configuration for it. You can regenerate a new mongoid.yml for
|
336
|
+
assistance via `rails g mongoid:config`.\n\n
|
337
|
+
Example:\n
|
338
|
+
\_\_development:\n
|
339
|
+
\_\_\_\_sessions:\n
|
340
|
+
\_\_\_\_\_\_default:\n
|
341
|
+
\_\_\_\_\_\_\_\_database: mongoid_dev\n
|
342
|
+
\_\_\_\_\_\_\_\_hosts:\n
|
343
|
+
\_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
|
344
|
+
no_session_database:
|
345
|
+
message: "No database provided for session configuration: :%{name}."
|
346
|
+
summary: "Each session configuration must provide a database so Mongoid
|
347
|
+
knows where the default database to persist to. What was provided
|
348
|
+
was: %{config}."
|
349
|
+
resolution: "If configuring via a mongoid.yml, ensure that within
|
350
|
+
your :%{name} section a :database value for the session's default
|
351
|
+
database is defined.\n\n
|
352
|
+
Example:\n
|
353
|
+
\_\_development:\n
|
354
|
+
\_\_\_\_sessions:\n
|
355
|
+
\_\_\_\_\_\_%{name}:\n
|
356
|
+
\_\_\_\_\_\_\_\_database: my_app_db\n
|
357
|
+
\_\_\_\_\_\_\_\_hosts:\n
|
358
|
+
\_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
|
359
|
+
no_session_hosts:
|
360
|
+
message: "No hosts provided for session configuration: :%{name}."
|
361
|
+
summary: "Each session configuration must provide hosts so Mongoid
|
362
|
+
knows where the database server is located. What was provided
|
363
|
+
was: %{config}."
|
364
|
+
resolution: "If configuring via a mongoid.yml, ensure that within
|
365
|
+
your :%{name} section a :hosts value for the session hosts is
|
366
|
+
defined.\n\n
|
367
|
+
Example:\n
|
368
|
+
\_\_development:\n
|
369
|
+
\_\_\_\_sessions:\n
|
370
|
+
\_\_\_\_\_\_%{name}:\n
|
371
|
+
\_\_\_\_\_\_\_\_database: my_app_db\n
|
372
|
+
\_\_\_\_\_\_\_\_hosts:\n
|
373
|
+
\_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
|
374
|
+
readonly_attribute:
|
375
|
+
message: "Attempted to set the readonly attribute '%{name}' with
|
376
|
+
the value: %{value}."
|
377
|
+
summary: "Attributes flagged as readonly via Model.attr_readonly
|
378
|
+
can only have values set when the document is a new record."
|
379
|
+
resolution: "Don't define '%{name}' as readonly, or do not attempt
|
380
|
+
to update it's value after the document is persisted."
|
61
381
|
scope_overwrite:
|
62
|
-
"Cannot create scope :%{scope_name}, because of existing
|
63
|
-
|
64
|
-
|
382
|
+
message: "Cannot create scope :%{scope_name}, because of existing
|
383
|
+
method %{model_name}.%{scope_name}."
|
384
|
+
summary: "When defining a scope that conflicts with a method that
|
385
|
+
already exists on the model, this error will get raised if
|
386
|
+
Mongoid.scope_overwrite_exception is set to true."
|
387
|
+
resolution: "Change the name of the scope so it does not conflict
|
388
|
+
with the already defined method %{model_name}, or set the
|
389
|
+
configuration option Mongoid.scope_overwrite_exception to false,
|
390
|
+
which is it's default. In this case a warning will be logged."
|
391
|
+
taken:
|
392
|
+
"is already taken"
|
393
|
+
too_many_nested_attribute_records:
|
394
|
+
message: "Accepting nested attributes for %{association} is limited
|
395
|
+
to %{limit} records."
|
396
|
+
summary: "More documents were sent to be processed than the allowed
|
397
|
+
limit."
|
398
|
+
resolution: "The limit is set as an option to the macro, for example:
|
399
|
+
accepts_nested_attributes_for :%{association}, limit: %{limit}.
|
400
|
+
Consider raising this limit or making sure no more are sent than
|
401
|
+
the set value."
|
402
|
+
unknown_attribute:
|
403
|
+
message: "Attempted to set a value for '%{name}' which is not
|
404
|
+
allowed on the model %{klass}."
|
405
|
+
summary: "When setting Mongoid.allow_dynamic_fields to false and the
|
406
|
+
attribute does not already exist in the attributes hash, attempting
|
407
|
+
to call %{klass}#%{name}= for it is not allowed. This is also
|
408
|
+
triggered by passing the attribute to any method that accepts an
|
409
|
+
attributes hash, and is raised instead of getting a NoMethodError."
|
410
|
+
resolution: "You can set Mongoid.allow_dynamic_fields to true if you
|
411
|
+
expect to be writing values for undefined fields often."
|
412
|
+
unsaved_document:
|
413
|
+
message: "Attempted to save %{document} before the parent %{base}."
|
414
|
+
summary: "You cannot call create or create! through the
|
415
|
+
relation (%{document}) who's parent (%{base}) is
|
416
|
+
not already saved. This would case the database to be out of sync
|
417
|
+
since the child could potentially reference a nonexistant parent."
|
418
|
+
resolution: "Make sure to only use create or create! when the parent
|
419
|
+
document %{base} is persisted."
|
420
|
+
unsupported_version:
|
421
|
+
message: "MongoDB %{version} not supported, please upgrade to
|
422
|
+
%{mongo_version}."
|
423
|
+
summary: "Mongoid is relying on features that were introduced in
|
424
|
+
MongoDB %{mongo_version} and would cause unexpected behaviour or errors
|
425
|
+
on version %{version}."
|
426
|
+
resolution: "Upgrade your MongoDB instances or keep Mongoid on your
|
427
|
+
previous version."
|
428
|
+
unsupported_javascript:
|
429
|
+
message: "Executing Javascript $where selector on an embedded criteria
|
430
|
+
is not supported."
|
431
|
+
summary: "Mongoid only supports providing a hash of arguments to
|
432
|
+
#where criterion on embedded documents. Since %{klass} is embedded,
|
433
|
+
the expression %{javascript} is not allowed."
|
434
|
+
resolution: "Please provide a standard hash to #where when the criteria
|
435
|
+
is for an embedded relation."
|
436
|
+
validations:
|
437
|
+
message: "Validation of %{document} failed."
|
438
|
+
summary: "The following errors were found: %{errors}"
|
439
|
+
resolution: "Try persisting the document with valid data or remove
|
440
|
+
the validations."
|
441
|
+
versioning_not_on_root:
|
442
|
+
message: "Versioning not allowed on embedded document: %{klass}."
|
443
|
+
summary: "Mongoid::Versioning behaviour is only allowed on documents
|
444
|
+
that are the root document in the hierarchy."
|
445
|
+
resolution: "Remove the versioning from the embedded %{klass} or
|
446
|
+
consider moving it to a root location in the hierarchy if
|
447
|
+
versioning is needed."
|
448
|
+
delete_restriction:
|
449
|
+
message: "Cannot delete %{document} because of dependent '%{relation}'."
|
450
|
+
summary: "When defining '%{relation}' with a :dependent => :restrict,
|
451
|
+
Mongoid will raise an error when attempting to delete the
|
452
|
+
%{document} when the child '%{relation}' still has documents in it."
|
453
|
+
resolution: "Don't attempt to delete the parent %{document} when
|
454
|
+
it has children, or change the dependent option on the relation."
|