mongoid 7.1.2 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +9 -2
- data/Rakefile +45 -5
- data/lib/config/locales/en.yml +38 -2
- data/lib/mongoid.rb +23 -0
- data/lib/mongoid/association/accessors.rb +37 -2
- data/lib/mongoid/association/depending.rb +1 -6
- data/lib/mongoid/association/many.rb +3 -3
- data/lib/mongoid/association/referenced/belongs_to/binding.rb +1 -1
- data/lib/mongoid/association/referenced/belongs_to/buildable.rb +1 -1
- data/lib/mongoid/association/referenced/has_and_belongs_to_many/proxy.rb +1 -1
- data/lib/mongoid/association/referenced/has_many/enumerable.rb +36 -1
- data/lib/mongoid/association/referenced/has_many/proxy.rb +8 -1
- data/lib/mongoid/association/referenced/has_one/buildable.rb +9 -1
- data/lib/mongoid/association/referenced/has_one/proxy.rb +6 -1
- data/lib/mongoid/atomic/modifiers.rb +1 -1
- data/lib/mongoid/attributes/dynamic.rb +1 -1
- data/lib/mongoid/clients/factory.rb +19 -2
- data/lib/mongoid/clients/options.rb +8 -8
- data/lib/mongoid/clients/sessions.rb +20 -4
- data/lib/mongoid/clients/storage_options.rb +5 -5
- data/lib/mongoid/composable.rb +1 -0
- data/lib/mongoid/config.rb +3 -0
- data/lib/mongoid/contextual/mongo.rb +23 -4
- data/lib/mongoid/copyable.rb +7 -3
- data/lib/mongoid/criteria.rb +57 -7
- data/lib/mongoid/criteria/queryable/extensions/regexp.rb +3 -3
- data/lib/mongoid/criteria/queryable/extensions/time_with_zone.rb +12 -0
- data/lib/mongoid/criteria/queryable/key.rb +1 -1
- data/lib/mongoid/criteria/queryable/mergeable.rb +2 -2
- data/lib/mongoid/criteria/queryable/selectable.rb +21 -6
- data/lib/mongoid/criteria/queryable/selector.rb +3 -3
- data/lib/mongoid/criteria/queryable/storable.rb +3 -3
- data/lib/mongoid/document.rb +15 -3
- data/lib/mongoid/errors.rb +7 -0
- data/lib/mongoid/errors/invalid_discriminator_key_target.rb +25 -0
- data/lib/mongoid/errors/invalid_elem_match_operator.rb +33 -0
- data/lib/mongoid/errors/invalid_estimated_count_criteria.rb +26 -0
- data/lib/mongoid/errors/invalid_expression_operator.rb +28 -0
- data/lib/mongoid/errors/invalid_field_operator.rb +33 -0
- data/lib/mongoid/errors/invalid_query.rb +41 -0
- data/lib/mongoid/errors/no_client_config.rb +2 -2
- data/lib/mongoid/errors/no_default_client.rb +1 -1
- data/lib/mongoid/extensions.rb +1 -0
- data/lib/mongoid/factory.rb +27 -10
- data/lib/mongoid/fields.rb +3 -0
- data/lib/mongoid/fields/validators/macro.rb +26 -10
- data/lib/mongoid/findable.rb +50 -14
- data/lib/mongoid/indexable.rb +2 -2
- data/lib/mongoid/matchable.rb +1 -149
- data/lib/mongoid/matcher.rb +127 -0
- data/lib/mongoid/matcher/all.rb +22 -0
- data/lib/mongoid/matcher/and.rb +21 -0
- data/lib/mongoid/matcher/elem_match.rb +35 -0
- data/lib/mongoid/matcher/elem_match_expression.rb +20 -0
- data/lib/mongoid/matcher/eq.rb +11 -0
- data/lib/mongoid/matcher/eq_impl.rb +32 -0
- data/lib/mongoid/matcher/eq_impl_with_regexp.rb +21 -0
- data/lib/mongoid/matcher/exists.rb +15 -0
- data/lib/mongoid/matcher/expression.rb +40 -0
- data/lib/mongoid/matcher/expression_operator.rb +19 -0
- data/lib/mongoid/matcher/field_expression.rb +63 -0
- data/lib/mongoid/matcher/field_operator.rb +52 -0
- data/lib/mongoid/matcher/gt.rb +17 -0
- data/lib/mongoid/matcher/gte.rb +17 -0
- data/lib/mongoid/matcher/in.rb +25 -0
- data/lib/mongoid/matcher/lt.rb +17 -0
- data/lib/mongoid/matcher/lte.rb +17 -0
- data/lib/mongoid/matcher/ne.rb +16 -0
- data/lib/mongoid/matcher/nin.rb +11 -0
- data/lib/mongoid/matcher/nor.rb +25 -0
- data/lib/mongoid/matcher/not.rb +29 -0
- data/lib/mongoid/matcher/or.rb +21 -0
- data/lib/mongoid/matcher/regex.rb +41 -0
- data/lib/mongoid/matcher/size.rb +26 -0
- data/lib/mongoid/persistable/deletable.rb +1 -1
- data/lib/mongoid/query_cache.rb +81 -37
- data/lib/mongoid/reloadable.rb +2 -2
- data/lib/mongoid/serializable.rb +1 -1
- data/lib/mongoid/stringified_symbol.rb +53 -0
- data/lib/mongoid/tasks/database.rb +38 -3
- data/lib/mongoid/traversable.rb +111 -4
- data/lib/mongoid/version.rb +1 -1
- data/spec/README.md +19 -4
- data/spec/integration/app_spec.rb +85 -23
- data/spec/integration/associations/embedded_spec.rb +94 -0
- data/spec/integration/associations/embeds_many_spec.rb +24 -0
- data/spec/integration/associations/embeds_one_spec.rb +24 -0
- data/spec/integration/associations/has_many_spec.rb +129 -0
- data/spec/integration/associations/has_one_spec.rb +129 -0
- data/spec/integration/associations/nested_attributes_assignment_spec.rb +116 -0
- data/spec/integration/atomic/modifiers_spec.rb +117 -0
- data/spec/integration/bson_regexp_raw_spec.rb +20 -0
- data/spec/integration/criteria/date_field_spec.rb +41 -0
- data/spec/integration/discriminator_key_spec.rb +354 -0
- data/spec/integration/discriminator_value_spec.rb +207 -0
- data/spec/integration/{matchable_spec.rb → matcher_examples_spec.rb} +120 -41
- data/spec/integration/matcher_operator_data/all.yml +140 -0
- data/spec/integration/matcher_operator_data/and.yml +93 -0
- data/spec/integration/matcher_operator_data/elem_match.yml +363 -0
- data/spec/integration/matcher_operator_data/elem_match_expr.yml +213 -0
- data/spec/integration/matcher_operator_data/eq.yml +191 -0
- data/spec/integration/matcher_operator_data/exists.yml +213 -0
- data/spec/integration/matcher_operator_data/generic_op.yml +17 -0
- data/spec/integration/matcher_operator_data/gt.yml +132 -0
- data/spec/integration/matcher_operator_data/gte.yml +132 -0
- data/spec/integration/matcher_operator_data/implicit.yml +331 -0
- data/spec/integration/matcher_operator_data/implicit_traversal.yml +16 -0
- data/spec/integration/matcher_operator_data/in.yml +194 -0
- data/spec/integration/matcher_operator_data/invalid_op.yml +59 -0
- data/spec/integration/matcher_operator_data/invalid_syntax.yml +39 -0
- data/spec/integration/matcher_operator_data/lt.yml +132 -0
- data/spec/integration/matcher_operator_data/lte.yml +132 -0
- data/spec/integration/matcher_operator_data/multiple.yml +29 -0
- data/spec/integration/matcher_operator_data/ne.yml +150 -0
- data/spec/integration/matcher_operator_data/nin.yml +114 -0
- data/spec/integration/matcher_operator_data/nor.yml +126 -0
- data/spec/integration/matcher_operator_data/not.yml +196 -0
- data/spec/integration/matcher_operator_data/or.yml +137 -0
- data/spec/integration/matcher_operator_data/regex.yml +174 -0
- data/spec/integration/matcher_operator_data/regex_options.yml +72 -0
- data/spec/integration/matcher_operator_data/size.yml +174 -0
- data/spec/integration/matcher_operator_spec.rb +100 -0
- data/spec/integration/matcher_spec.rb +189 -0
- data/spec/integration/server_query_spec.rb +142 -0
- data/spec/integration/shardable_spec.rb +20 -4
- data/spec/integration/stringified_symbol_field_spec.rb +190 -0
- data/spec/lite_spec_helper.rb +4 -2
- data/spec/mongoid/association/accessors_spec.rb +238 -63
- data/spec/mongoid/association/depending_spec.rb +78 -26
- data/spec/mongoid/association/embedded/embeds_many/proxy_spec.rb +33 -0
- data/spec/mongoid/association/embedded/embeds_many_models.rb +1 -0
- data/spec/mongoid/association/embedded/embeds_one_models.rb +1 -0
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb +138 -0
- data/spec/mongoid/association/referenced/has_many/enumerable_spec.rb +105 -0
- data/spec/mongoid/association/referenced/has_many/proxy_spec.rb +460 -186
- data/spec/mongoid/association/referenced/has_many_models.rb +21 -0
- data/spec/mongoid/association/referenced/has_one_models.rb +21 -0
- data/spec/mongoid/association/referenced/has_one_spec.rb +1 -1
- data/spec/mongoid/atomic/modifiers_spec.rb +47 -0
- data/spec/mongoid/atomic_spec.rb +23 -0
- data/spec/mongoid/attributes/nested_spec.rb +1 -1
- data/spec/mongoid/clients/factory_spec.rb +45 -8
- data/spec/mongoid/clients/options_spec.rb +9 -9
- data/spec/mongoid/clients/sessions_spec.rb +1 -6
- data/spec/mongoid/config_spec.rb +28 -0
- data/spec/mongoid/contextual/geo_near_spec.rb +11 -2
- data/spec/mongoid/contextual/mongo_spec.rb +70 -16
- data/spec/mongoid/copyable_spec.rb +197 -18
- data/spec/mongoid/copyable_spec_models.rb +28 -0
- data/spec/mongoid/criteria/queryable/extensions/regexp_raw_spec.rb +1 -1
- data/spec/mongoid/criteria/queryable/extensions/time_spec.rb +19 -7
- data/spec/mongoid/criteria/queryable/extensions/time_with_zone_spec.rb +28 -1
- data/spec/mongoid/criteria/queryable/selectable_spec.rb +84 -82
- data/spec/mongoid/criteria_spec.rb +204 -39
- data/spec/mongoid/document_spec.rb +89 -15
- data/spec/mongoid/equality_spec.rb +0 -1
- data/spec/mongoid/errors/delete_restriction_spec.rb +1 -1
- data/spec/mongoid/errors/no_client_config_spec.rb +2 -2
- data/spec/mongoid/errors/no_client_database_spec.rb +3 -3
- data/spec/mongoid/errors/no_client_hosts_spec.rb +3 -3
- data/spec/mongoid/extensions/stringified_symbol_spec.rb +85 -0
- data/spec/mongoid/factory_spec.rb +261 -28
- data/spec/mongoid/fields_spec.rb +72 -3
- data/spec/mongoid/findable_spec.rb +32 -0
- data/spec/mongoid/indexable_spec.rb +28 -2
- data/spec/mongoid/inspectable_spec.rb +29 -2
- data/spec/mongoid/interceptable_spec.rb +2 -2
- data/spec/mongoid/matcher/extract_attribute_data/traversal.yml +259 -0
- data/spec/mongoid/matcher/extract_attribute_spec.rb +47 -0
- data/spec/mongoid/persistable/creatable_spec.rb +108 -25
- data/spec/mongoid/persistable/deletable_spec.rb +86 -0
- data/spec/mongoid/persistable/savable_spec.rb +174 -16
- data/spec/mongoid/query_cache_middleware_spec.rb +16 -3
- data/spec/mongoid/query_cache_spec.rb +496 -28
- data/spec/mongoid/reloadable_spec.rb +72 -0
- data/spec/mongoid/serializable_spec.rb +21 -3
- data/spec/mongoid/traversable_spec.rb +1100 -0
- data/spec/shared/LICENSE +20 -0
- data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
- data/spec/shared/lib/mrss/constraints.rb +303 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +175 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +149 -0
- data/spec/spec_helper.rb +4 -2
- data/spec/support/constraints.rb +20 -222
- data/spec/support/helpers.rb +1 -1
- data/spec/{app → support}/models/account.rb +0 -0
- data/spec/{app → support}/models/acolyte.rb +0 -0
- data/spec/{app → support}/models/actor.rb +1 -1
- data/spec/{app → support}/models/actress.rb +0 -0
- data/spec/{app → support}/models/address.rb +0 -0
- data/spec/{app → support}/models/address_component.rb +0 -0
- data/spec/{app → support}/models/address_number.rb +0 -0
- data/spec/{app → support}/models/agency.rb +0 -0
- data/spec/{app → support}/models/agent.rb +0 -0
- data/spec/{app → support}/models/album.rb +0 -0
- data/spec/{app → support}/models/alert.rb +0 -0
- data/spec/{app → support}/models/animal.rb +0 -0
- data/spec/{app → support}/models/answer.rb +0 -0
- data/spec/{app → support}/models/appointment.rb +0 -0
- data/spec/support/models/armrest.rb +10 -0
- data/spec/{app → support}/models/array_field.rb +0 -0
- data/spec/{app → support}/models/article.rb +0 -0
- data/spec/{app → support}/models/artist.rb +0 -0
- data/spec/{app → support}/models/artwork.rb +0 -0
- data/spec/{app → support}/models/audio.rb +0 -0
- data/spec/{app → support}/models/augmentation.rb +0 -0
- data/spec/{app → support}/models/author.rb +0 -0
- data/spec/{app → support}/models/baby.rb +0 -0
- data/spec/{app → support}/models/band.rb +0 -0
- data/spec/{app → support}/models/bar.rb +0 -0
- data/spec/{app → support}/models/basic.rb +0 -0
- data/spec/{app → support}/models/bed.rb +0 -0
- data/spec/{app → support}/models/big_palette.rb +0 -0
- data/spec/{app → support}/models/birthday.rb +0 -0
- data/spec/{app → support}/models/bomb.rb +0 -0
- data/spec/{app → support}/models/book.rb +0 -0
- data/spec/{app → support}/models/breed.rb +0 -0
- data/spec/{app → support}/models/browser.rb +1 -1
- data/spec/{app → support}/models/building.rb +0 -0
- data/spec/{app → support}/models/building_address.rb +0 -0
- data/spec/{app → support}/models/bus.rb +0 -0
- data/spec/{app → support}/models/business.rb +0 -0
- data/spec/{app → support}/models/callback_test.rb +0 -0
- data/spec/{app → support}/models/canvas.rb +1 -1
- data/spec/{app → support}/models/car.rb +0 -0
- data/spec/{app → support}/models/cat.rb +0 -0
- data/spec/{app → support}/models/category.rb +0 -0
- data/spec/{app → support}/models/child.rb +0 -0
- data/spec/{app → support}/models/child_doc.rb +0 -0
- data/spec/{app → support}/models/church.rb +0 -0
- data/spec/{app → support}/models/circle.rb +0 -0
- data/spec/{app → support}/models/circuit.rb +0 -0
- data/spec/{app → support}/models/circus.rb +0 -0
- data/spec/{app → support}/models/code.rb +0 -0
- data/spec/{app → support}/models/coding.rb +1 -1
- data/spec/{app → support}/models/coding/pull_request.rb +0 -0
- data/spec/{app → support}/models/comment.rb +0 -0
- data/spec/{app → support}/models/company.rb +0 -0
- data/spec/{app → support}/models/consumption_period.rb +0 -0
- data/spec/{app → support}/models/contextable_item.rb +0 -0
- data/spec/{app → support}/models/contractor.rb +0 -0
- data/spec/{app → support}/models/cookie.rb +0 -0
- data/spec/{app → support}/models/country_code.rb +0 -0
- data/spec/{app → support}/models/courier_job.rb +0 -0
- data/spec/support/models/crate.rb +13 -0
- data/spec/support/models/deed.rb +8 -0
- data/spec/{app → support}/models/definition.rb +0 -0
- data/spec/{app → support}/models/delegating_patient.rb +0 -0
- data/spec/{app → support}/models/description.rb +0 -0
- data/spec/{app → support}/models/dictionary.rb +0 -0
- data/spec/{app → support}/models/division.rb +0 -0
- data/spec/{app → support}/models/doctor.rb +0 -0
- data/spec/{app → support}/models/dog.rb +0 -0
- data/spec/{app → support}/models/dokument.rb +0 -0
- data/spec/{app → support}/models/draft.rb +0 -0
- data/spec/{app → support}/models/dragon.rb +0 -0
- data/spec/{app → support}/models/driver.rb +1 -1
- data/spec/{app → support}/models/drug.rb +0 -0
- data/spec/{app → support}/models/dungeon.rb +0 -0
- data/spec/{app → support}/models/edit.rb +0 -0
- data/spec/{app → support}/models/email.rb +0 -0
- data/spec/{app → support}/models/employer.rb +0 -0
- data/spec/{app → support}/models/entry.rb +0 -0
- data/spec/{app → support}/models/eraser.rb +0 -0
- data/spec/{app → support}/models/even.rb +0 -0
- data/spec/{app → support}/models/event.rb +0 -0
- data/spec/{app → support}/models/exhibition.rb +0 -0
- data/spec/{app → support}/models/exhibitor.rb +0 -0
- data/spec/{app → support}/models/explosion.rb +0 -0
- data/spec/{app → support}/models/eye.rb +0 -0
- data/spec/{app → support}/models/eye_bowl.rb +0 -0
- data/spec/{app → support}/models/face.rb +0 -0
- data/spec/{app → support}/models/favorite.rb +0 -0
- data/spec/{app → support}/models/filesystem.rb +0 -0
- data/spec/{app → support}/models/fire_hydrant.rb +0 -0
- data/spec/{app → support}/models/firefox.rb +0 -0
- data/spec/{app → support}/models/fish.rb +0 -0
- data/spec/{app → support}/models/folder.rb +0 -0
- data/spec/{app → support}/models/folder_item.rb +0 -0
- data/spec/{app → support}/models/fruits.rb +0 -0
- data/spec/{app → support}/models/game.rb +0 -0
- data/spec/{app → support}/models/ghost.rb +0 -0
- data/spec/support/models/guitar.rb +5 -0
- data/spec/{app → support}/models/home.rb +0 -0
- data/spec/{app → support}/models/house.rb +0 -0
- data/spec/{app → support}/models/html_writer.rb +0 -0
- data/spec/{app → support}/models/id_key.rb +0 -0
- data/spec/support/models/idnodef.rb +8 -0
- data/spec/{app → support}/models/image.rb +0 -0
- data/spec/{app → support}/models/implant.rb +0 -0
- data/spec/support/models/instrument.rb +9 -0
- data/spec/{app → support}/models/item.rb +1 -1
- data/spec/{app → support}/models/jar.rb +0 -0
- data/spec/{app → support}/models/kaleidoscope.rb +0 -0
- data/spec/{app → support}/models/kangaroo.rb +0 -0
- data/spec/{app → support}/models/label.rb +0 -0
- data/spec/{app → support}/models/language.rb +0 -0
- data/spec/{app → support}/models/lat_lng.rb +0 -0
- data/spec/{app → support}/models/league.rb +0 -0
- data/spec/{app → support}/models/learner.rb +0 -0
- data/spec/{app → support}/models/line_item.rb +0 -0
- data/spec/{app → support}/models/location.rb +0 -0
- data/spec/{app → support}/models/login.rb +0 -0
- data/spec/{app → support}/models/manufacturer.rb +0 -0
- data/spec/{app → support}/models/meat.rb +0 -0
- data/spec/{app → support}/models/membership.rb +0 -0
- data/spec/{app → support}/models/message.rb +0 -0
- data/spec/{app → support}/models/minim.rb +0 -0
- data/spec/{app → support}/models/mixed_drink.rb +0 -0
- data/spec/support/models/mop.rb +16 -0
- data/spec/{app → support}/models/movie.rb +0 -0
- data/spec/{app → support}/models/my_hash.rb +0 -0
- data/spec/{app → support}/models/name.rb +0 -0
- data/spec/{app → support}/models/name_only.rb +0 -0
- data/spec/{app → support}/models/node.rb +0 -0
- data/spec/{app → support}/models/note.rb +0 -0
- data/spec/{app → support}/models/odd.rb +0 -0
- data/spec/support/models/order.rb +11 -0
- data/spec/{app → support}/models/ordered_post.rb +0 -0
- data/spec/{app → support}/models/ordered_preference.rb +0 -0
- data/spec/{app → support}/models/oscar.rb +0 -0
- data/spec/{app → support}/models/other_owner_object.rb +0 -0
- data/spec/{app → support}/models/override.rb +0 -0
- data/spec/{app → support}/models/ownable.rb +0 -0
- data/spec/{app → support}/models/owner.rb +2 -0
- data/spec/{app → support}/models/pack.rb +0 -0
- data/spec/{app → support}/models/page.rb +0 -0
- data/spec/{app → support}/models/page_question.rb +0 -0
- data/spec/{app → support}/models/palette.rb +1 -1
- data/spec/{app → support}/models/parent.rb +0 -0
- data/spec/{app → support}/models/parent_doc.rb +0 -0
- data/spec/{app → support}/models/passport.rb +1 -0
- data/spec/{app → support}/models/patient.rb +0 -0
- data/spec/{app → support}/models/pdf_writer.rb +0 -0
- data/spec/{app → support}/models/pencil.rb +0 -0
- data/spec/{app → support}/models/person.rb +3 -1
- data/spec/{app → support}/models/pet.rb +0 -0
- data/spec/{app → support}/models/pet_owner.rb +0 -0
- data/spec/{app → support}/models/phone.rb +1 -0
- data/spec/support/models/piano.rb +5 -0
- data/spec/{app → support}/models/pizza.rb +0 -0
- data/spec/{app → support}/models/player.rb +0 -0
- data/spec/{app → support}/models/post.rb +0 -0
- data/spec/{app → support}/models/post_genre.rb +0 -0
- data/spec/{app → support}/models/powerup.rb +0 -0
- data/spec/{app → support}/models/preference.rb +0 -0
- data/spec/{app → support}/models/princess.rb +0 -0
- data/spec/{app → support}/models/product.rb +0 -0
- data/spec/support/models/profile.rb +18 -0
- data/spec/{app → support}/models/pronunciation.rb +0 -0
- data/spec/{app → support}/models/pub.rb +0 -0
- data/spec/support/models/publication.rb +5 -0
- data/spec/{app → support}/models/publication/encyclopedia.rb +0 -0
- data/spec/{app → support}/models/publication/review.rb +0 -0
- data/spec/{app → support}/models/purchase.rb +0 -0
- data/spec/{app → support}/models/question.rb +0 -0
- data/spec/{app → support}/models/quiz.rb +0 -0
- data/spec/{app → support}/models/rating.rb +0 -0
- data/spec/{app → support}/models/record.rb +0 -0
- data/spec/{app → support}/models/registry.rb +0 -0
- data/spec/{app → support}/models/role.rb +0 -0
- data/spec/{app → support}/models/root_category.rb +0 -0
- data/spec/{app → support}/models/sandwich.rb +0 -0
- data/spec/{app → support}/models/scheduler.rb +0 -0
- data/spec/{app/models/profile.rb → support/models/scribe.rb} +2 -2
- data/spec/support/models/seat.rb +25 -0
- data/spec/{app → support}/models/seo.rb +0 -0
- data/spec/{app → support}/models/series.rb +1 -0
- data/spec/{app → support}/models/server.rb +0 -0
- data/spec/{app → support}/models/service.rb +0 -0
- data/spec/{app → support}/models/shape.rb +2 -2
- data/spec/{app → support}/models/shelf.rb +0 -0
- data/spec/{app → support}/models/shipment_address.rb +0 -0
- data/spec/{app → support}/models/shipping_container.rb +0 -0
- data/spec/{app → support}/models/shipping_pack.rb +0 -0
- data/spec/{app → support}/models/shop.rb +0 -0
- data/spec/{app → support}/models/short_agent.rb +0 -0
- data/spec/{app → support}/models/short_quiz.rb +0 -0
- data/spec/{app → support}/models/simple.rb +0 -0
- data/spec/{app → support}/models/slave.rb +0 -0
- data/spec/{app → support}/models/song.rb +0 -0
- data/spec/{app → support}/models/sound.rb +0 -0
- data/spec/{app → support}/models/square.rb +0 -0
- data/spec/{app → support}/models/staff.rb +0 -0
- data/spec/{app → support}/models/store_as_dup_test1.rb +0 -0
- data/spec/{app → support}/models/store_as_dup_test2.rb +0 -0
- data/spec/{app → support}/models/store_as_dup_test3.rb +0 -0
- data/spec/{app → support}/models/store_as_dup_test4.rb +0 -0
- data/spec/{app → support}/models/strategy.rb +0 -0
- data/spec/{app → support}/models/sub_item.rb +0 -0
- data/spec/{app → support}/models/subscription.rb +0 -0
- data/spec/{app → support}/models/survey.rb +0 -0
- data/spec/{app → support}/models/symptom.rb +0 -0
- data/spec/support/models/system_role.rb +7 -0
- data/spec/{app → support}/models/tag.rb +0 -0
- data/spec/{app → support}/models/target.rb +0 -0
- data/spec/{app → support}/models/template.rb +0 -0
- data/spec/{app → support}/models/thing.rb +0 -0
- data/spec/{app → support}/models/title.rb +0 -0
- data/spec/{app → support}/models/tool.rb +2 -2
- data/spec/{app → support}/models/topping.rb +0 -0
- data/spec/support/models/toy.rb +10 -0
- data/spec/{app → support}/models/track.rb +0 -0
- data/spec/{app → support}/models/translation.rb +0 -0
- data/spec/{app → support}/models/tree.rb +0 -0
- data/spec/{app → support}/models/truck.rb +2 -0
- data/spec/{app → support}/models/updatable.rb +0 -0
- data/spec/{app → support}/models/user.rb +0 -0
- data/spec/{app → support}/models/user_account.rb +0 -0
- data/spec/{app → support}/models/validation_callback.rb +0 -0
- data/spec/{app → support}/models/vehicle.rb +7 -2
- data/spec/{app → support}/models/version.rb +0 -0
- data/spec/{app → support}/models/vertex.rb +0 -0
- data/spec/{app → support}/models/vet_visit.rb +0 -0
- data/spec/{app → support}/models/video.rb +0 -0
- data/spec/{app → support}/models/video_game.rb +0 -0
- data/spec/{app → support}/models/weapon.rb +0 -0
- data/spec/{app → support}/models/wiki_page.rb +1 -0
- data/spec/{app → support}/models/word.rb +0 -0
- data/spec/{app → support}/models/word_origin.rb +0 -0
- data/spec/{app → support}/models/writer.rb +2 -2
- data/spec/support/session_registry.rb +50 -0
- data/spec/support/spec_config.rb +1 -1
- metadata +857 -739
- metadata.gz.sig +0 -0
- data/lib/mongoid/matchable/all.rb +0 -30
- data/lib/mongoid/matchable/and.rb +0 -32
- data/lib/mongoid/matchable/default.rb +0 -121
- data/lib/mongoid/matchable/elem_match.rb +0 -36
- data/lib/mongoid/matchable/eq.rb +0 -23
- data/lib/mongoid/matchable/exists.rb +0 -25
- data/lib/mongoid/matchable/gt.rb +0 -25
- data/lib/mongoid/matchable/gte.rb +0 -25
- data/lib/mongoid/matchable/in.rb +0 -26
- data/lib/mongoid/matchable/lt.rb +0 -25
- data/lib/mongoid/matchable/lte.rb +0 -25
- data/lib/mongoid/matchable/ne.rb +0 -23
- data/lib/mongoid/matchable/nin.rb +0 -24
- data/lib/mongoid/matchable/nor.rb +0 -38
- data/lib/mongoid/matchable/or.rb +0 -35
- data/lib/mongoid/matchable/regexp.rb +0 -30
- data/lib/mongoid/matchable/size.rb +0 -23
- data/spec/app/models/publication.rb +0 -5
- data/spec/mongoid/matchable/all_spec.rb +0 -34
- data/spec/mongoid/matchable/and_spec.rb +0 -190
- data/spec/mongoid/matchable/default_spec.rb +0 -140
- data/spec/mongoid/matchable/elem_match_spec.rb +0 -109
- data/spec/mongoid/matchable/eq_spec.rb +0 -49
- data/spec/mongoid/matchable/exists_spec.rb +0 -60
- data/spec/mongoid/matchable/gt_spec.rb +0 -89
- data/spec/mongoid/matchable/gte_spec.rb +0 -87
- data/spec/mongoid/matchable/in_spec.rb +0 -52
- data/spec/mongoid/matchable/lt_spec.rb +0 -88
- data/spec/mongoid/matchable/lte_spec.rb +0 -88
- data/spec/mongoid/matchable/ne_spec.rb +0 -49
- data/spec/mongoid/matchable/nin_spec.rb +0 -51
- data/spec/mongoid/matchable/nor_spec.rb +0 -210
- data/spec/mongoid/matchable/or_spec.rb +0 -134
- data/spec/mongoid/matchable/regexp_spec.rb +0 -62
- data/spec/mongoid/matchable/size_spec.rb +0 -28
- data/spec/mongoid/matchable_spec.rb +0 -856
- data/spec/support/child_process_helper.rb +0 -76
- data/spec/support/lite_constraints.rb +0 -22
@@ -54,9 +54,14 @@ module Mongoid
|
|
54
54
|
#
|
55
55
|
# @since 2.0.0.rc.1
|
56
56
|
def substitute(replacement)
|
57
|
+
# If the same object currently associated is being assigned,
|
58
|
+
# rebind the association and save the target but do not destroy
|
59
|
+
# the target.
|
60
|
+
|
57
61
|
unbind_one
|
58
62
|
if persistable?
|
59
|
-
if
|
63
|
+
# TODO can this entire method be skipped if self == replacement?
|
64
|
+
if _association.destructive? && self != replacement
|
60
65
|
send(_association.dependent)
|
61
66
|
else
|
62
67
|
save if persisted?
|
@@ -193,7 +193,7 @@ module Mongoid
|
|
193
193
|
def push_conflict?(field)
|
194
194
|
name = field.split(".", 2)[0]
|
195
195
|
set_fields.has_key?(name) || pull_fields.has_key?(name) ||
|
196
|
-
(push_fields.keys.count { |item| item
|
196
|
+
(push_fields.keys.count { |item| item.split('.', 2).first == name } > 1)
|
197
197
|
end
|
198
198
|
|
199
199
|
# Get the conflicting pull modifications.
|
@@ -116,7 +116,7 @@ module Mongoid
|
|
116
116
|
#
|
117
117
|
# @since 4.0.0
|
118
118
|
def inspect_dynamic_fields
|
119
|
-
keys = attributes.keys - fields.keys - relations.keys - ["_id",
|
119
|
+
keys = attributes.keys - fields.keys - relations.keys - ["_id", self.class.discriminator_key]
|
120
120
|
return keys.map do |name|
|
121
121
|
"#{name}: #{attributes[name].inspect}"
|
122
122
|
end
|
@@ -12,9 +12,9 @@ module Mongoid
|
|
12
12
|
# raised.
|
13
13
|
#
|
14
14
|
# @example Create the client.
|
15
|
-
# Factory.create(:
|
15
|
+
# Factory.create(:analytics)
|
16
16
|
#
|
17
|
-
# @param [ String
|
17
|
+
# @param [ String | Symbol ] name The named client configuration.
|
18
18
|
#
|
19
19
|
# @raise [ Errors::NoClientConfig ] If no config could be found.
|
20
20
|
#
|
@@ -69,11 +69,28 @@ module Mongoid
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
MONGOID_WRAPPING_LIBRARY = {
|
73
|
+
name: 'Mongoid',
|
74
|
+
version: VERSION,
|
75
|
+
}.freeze
|
76
|
+
|
77
|
+
def driver_version
|
78
|
+
Mongo::VERSION.split('.')[0...2].map(&:to_i)
|
79
|
+
end
|
80
|
+
|
72
81
|
def options(configuration)
|
73
82
|
config = configuration.dup
|
74
83
|
options = config.delete(:options) || {}
|
75
84
|
options[:platform] = PLATFORM_DETAILS
|
76
85
|
options[:app_name] = Mongoid::Config.app_name if Mongoid::Config.app_name
|
86
|
+
if (driver_version <=> [2, 13]) >= 0
|
87
|
+
wrap_lib = if options[:wrapping_libraries]
|
88
|
+
[MONGOID_WRAPPING_LIBRARY] + options[:wrapping_libraries]
|
89
|
+
else
|
90
|
+
[MONGOID_WRAPPING_LIBRARY]
|
91
|
+
end
|
92
|
+
options[:wrapping_libraries] = wrap_lib
|
93
|
+
end
|
77
94
|
options.reject{ |k, v| k == :hosts }.to_hash.symbolize_keys!
|
78
95
|
end
|
79
96
|
end
|
@@ -9,16 +9,16 @@ module Mongoid
|
|
9
9
|
# Change the persistence context for this object during the block.
|
10
10
|
#
|
11
11
|
# @example Save the current document to a different collection.
|
12
|
-
# model.with(collection: "
|
12
|
+
# model.with(collection: "bands") do |m|
|
13
13
|
# m.save
|
14
14
|
# end
|
15
15
|
#
|
16
16
|
# @param [ Hash, Mongoid::PersistenceContext ] options_or_context
|
17
17
|
# The storage options or a persistence context.
|
18
18
|
#
|
19
|
-
# @option options [ String
|
20
|
-
# @option options [ String
|
21
|
-
# @option options [ String
|
19
|
+
# @option options [ String | Symbol ] :collection The collection name.
|
20
|
+
# @option options [ String | Symbol ] :database The database name.
|
21
|
+
# @option options [ String | Symbol ] :client The client name.
|
22
22
|
#
|
23
23
|
# @since 6.0.0
|
24
24
|
def with(options_or_context, &block)
|
@@ -83,15 +83,15 @@ module Mongoid
|
|
83
83
|
# Change the persistence context for this class during the block.
|
84
84
|
#
|
85
85
|
# @example Save the current document to a different collection.
|
86
|
-
# Model.with(collection: "
|
86
|
+
# Model.with(collection: "bands") do |m|
|
87
87
|
# m.create
|
88
88
|
# end
|
89
89
|
#
|
90
90
|
# @param [ Hash ] options The storage options.
|
91
91
|
#
|
92
|
-
# @option options [ String
|
93
|
-
# @option options [ String
|
94
|
-
# @option options [ String
|
92
|
+
# @option options [ String | Symbol ] :collection The collection name.
|
93
|
+
# @option options [ String | Symbol ] :database The database name.
|
94
|
+
# @option options [ String | Symbol ] :client The client name.
|
95
95
|
#
|
96
96
|
# @since 6.0.0
|
97
97
|
def with(options, &block)
|
@@ -41,12 +41,20 @@ module Mongoid
|
|
41
41
|
#
|
42
42
|
# @since 6.4.0
|
43
43
|
def with_session(options = {})
|
44
|
-
|
44
|
+
if Threaded.get_session
|
45
|
+
raise Mongoid::Errors::InvalidSessionUse.new(:invalid_session_nesting)
|
46
|
+
end
|
45
47
|
session = persistence_context.client.start_session(options)
|
46
48
|
Threaded.set_session(session)
|
47
49
|
yield(session)
|
48
50
|
rescue Mongo::Error::InvalidSession => ex
|
49
|
-
if
|
51
|
+
if
|
52
|
+
# Driver 2.13.0+
|
53
|
+
defined?(Mongo::Error::SessionsNotSupported) &&
|
54
|
+
Mongo::Error::SessionsNotSupported === ex ||
|
55
|
+
# Legacy drivers
|
56
|
+
ex.message == Mongo::Session::SESSIONS_NOT_SUPPORTED
|
57
|
+
then
|
50
58
|
raise Mongoid::Errors::InvalidSessionUse.new(:sessions_not_supported)
|
51
59
|
end
|
52
60
|
raise Mongoid::Errors::InvalidSessionUse.new(:invalid_session_use)
|
@@ -92,12 +100,20 @@ module Mongoid
|
|
92
100
|
#
|
93
101
|
# @since 6.4.0
|
94
102
|
def with_session(options = {})
|
95
|
-
|
103
|
+
if Threaded.get_session
|
104
|
+
raise Mongoid::Errors::InvalidSessionUse.new(:invalid_session_nesting)
|
105
|
+
end
|
96
106
|
session = persistence_context.client.start_session(options)
|
97
107
|
Threaded.set_session(session)
|
98
108
|
yield(session)
|
99
109
|
rescue Mongo::Error::InvalidSession => ex
|
100
|
-
if
|
110
|
+
if
|
111
|
+
# Driver 2.13.0+
|
112
|
+
defined?(Mongo::Error::SessionsNotSupported) &&
|
113
|
+
Mongo::Error::SessionsNotSupported === ex ||
|
114
|
+
# Legacy drivers
|
115
|
+
ex.message == Mongo::Session::SESSIONS_NOT_SUPPORTED
|
116
|
+
then
|
101
117
|
raise Mongoid::Errors::InvalidSessionUse.new(:sessions_not_supported)
|
102
118
|
end
|
103
119
|
raise Mongoid::Errors::InvalidSessionUse.new(:invalid_session_use)
|
@@ -32,20 +32,20 @@ module Mongoid
|
|
32
32
|
# @example Store this model by default in a different client.
|
33
33
|
# class Band
|
34
34
|
# include Mongoid::Document
|
35
|
-
# store_in client: "
|
35
|
+
# store_in client: "analytics"
|
36
36
|
# end
|
37
37
|
#
|
38
38
|
# @example Store this model with a combination of options.
|
39
39
|
# class Band
|
40
40
|
# include Mongoid::Document
|
41
|
-
# store_in collection: "artists", database: "
|
41
|
+
# store_in collection: "artists", database: "music"
|
42
42
|
# end
|
43
43
|
#
|
44
44
|
# @param [ Hash ] options The storage options.
|
45
45
|
#
|
46
|
-
# @option options [ String
|
47
|
-
# @option options [ String
|
48
|
-
# @option options [ String
|
46
|
+
# @option options [ String | Symbol ] :collection The collection name.
|
47
|
+
# @option options [ String | Symbol ] :database The database name.
|
48
|
+
# @option options [ String | Symbol ] :client The client name.
|
49
49
|
#
|
50
50
|
# @return [ Class ] The model class.
|
51
51
|
#
|
data/lib/mongoid/composable.rb
CHANGED
data/lib/mongoid/config.rb
CHANGED
@@ -32,6 +32,9 @@ module Mongoid
|
|
32
32
|
# error.
|
33
33
|
option :belongs_to_required_by_default, default: true
|
34
34
|
|
35
|
+
# Set the global discriminator key.
|
36
|
+
option :discriminator_key, default: "_type"
|
37
|
+
|
35
38
|
# Raise an exception when a field is redefined.
|
36
39
|
option :duplicate_fields_exception, default: false
|
37
40
|
|
@@ -71,7 +71,26 @@ module Mongoid
|
|
71
71
|
# @since 3.0.0
|
72
72
|
def count(options = {}, &block)
|
73
73
|
return super(&block) if block_given?
|
74
|
-
try_cache(:count) { view.
|
74
|
+
try_cache(:count) { view.count_documents(options) }
|
75
|
+
end
|
76
|
+
|
77
|
+
# Get the estimated number of documents matching the query.
|
78
|
+
#
|
79
|
+
# Unlike count, estimated_count does not take a block because it is not
|
80
|
+
# traditionally defined (with a block) on Enumarable like count is.
|
81
|
+
#
|
82
|
+
# @example Get the estimated number of matching documents.
|
83
|
+
# context.estimated_count
|
84
|
+
#
|
85
|
+
# @param [ Hash ] options The options, such as maxTimeMS to be factored
|
86
|
+
# into the count.
|
87
|
+
#
|
88
|
+
# @return [ Integer ] The number of matches.
|
89
|
+
def estimated_count(options = {})
|
90
|
+
unless self.criteria.selector.empty?
|
91
|
+
raise Mongoid::Errors::InvalidEstimatedCountCriteria.new(self.klass)
|
92
|
+
end
|
93
|
+
try_cache(:estimated_count) { view.estimated_document_count(options) }
|
75
94
|
end
|
76
95
|
|
77
96
|
# Delete all documents in the database that match the selector.
|
@@ -258,12 +277,12 @@ module Mongoid
|
|
258
277
|
return documents.first if cached? && cache_loaded?
|
259
278
|
try_cache(:first) do
|
260
279
|
if sort = view.sort || ({ _id: 1 } unless opts[:id_sort] == :none)
|
261
|
-
if raw_doc = view.sort(sort).limit(
|
280
|
+
if raw_doc = view.sort(sort).limit(1).first
|
262
281
|
doc = Factory.from_db(klass, raw_doc, criteria)
|
263
282
|
eager_load([doc]).first
|
264
283
|
end
|
265
284
|
else
|
266
|
-
if raw_doc = view.limit(
|
285
|
+
if raw_doc = view.limit(1).first
|
267
286
|
doc = Factory.from_db(klass, raw_doc, criteria)
|
268
287
|
eager_load([doc]).first
|
269
288
|
end
|
@@ -372,7 +391,7 @@ module Mongoid
|
|
372
391
|
def last(opts = {})
|
373
392
|
try_cache(:last) do
|
374
393
|
with_inverse_sorting(opts) do
|
375
|
-
if raw_doc = view.limit(
|
394
|
+
if raw_doc = view.limit(1).first
|
376
395
|
doc = Factory.from_db(klass, raw_doc, criteria)
|
377
396
|
eager_load([doc]).first
|
378
397
|
end
|
data/lib/mongoid/copyable.rb
CHANGED
@@ -23,8 +23,12 @@ module Mongoid
|
|
23
23
|
# elsewhere.
|
24
24
|
attrs = clone_document.except("_id", "id")
|
25
25
|
dynamic_attrs = {}
|
26
|
+
_attribute_names = self.attribute_names
|
26
27
|
attrs.reject! do |attr_name, value|
|
27
|
-
|
28
|
+
unless _attribute_names.include?(attr_name)
|
29
|
+
dynamic_attrs[attr_name] = value
|
30
|
+
true
|
31
|
+
end
|
28
32
|
end
|
29
33
|
self.class.new(attrs).tap do |object|
|
30
34
|
dynamic_attrs.each do |attr_name, value|
|
@@ -76,8 +80,8 @@ module Mongoid
|
|
76
80
|
|
77
81
|
if association.is_a?(Association::Embedded::EmbedsMany)
|
78
82
|
attrs[association.key].each do |attr|
|
79
|
-
embedded_klass = if type = attr[
|
80
|
-
type.
|
83
|
+
embedded_klass = if type = attr[self.class.discriminator_key]
|
84
|
+
association.relation_class.get_discriminator_mapping(type) || association.relation_class
|
81
85
|
else
|
82
86
|
association.relation_class
|
83
87
|
end
|
data/lib/mongoid/criteria.rb
CHANGED
@@ -20,9 +20,17 @@ module Mongoid
|
|
20
20
|
# against the database.
|
21
21
|
class Criteria
|
22
22
|
include Enumerable
|
23
|
+
|
24
|
+
# @api private
|
25
|
+
alias :_enumerable_find :find
|
26
|
+
|
23
27
|
include Contextual
|
24
28
|
include Queryable
|
25
29
|
include Findable
|
30
|
+
|
31
|
+
# @api private
|
32
|
+
alias :_findable_find :find
|
33
|
+
|
26
34
|
include Inspectable
|
27
35
|
include Includable
|
28
36
|
include Marshalable
|
@@ -55,6 +63,48 @@ module Mongoid
|
|
55
63
|
entries == other
|
56
64
|
end
|
57
65
|
|
66
|
+
# Finds one or many documents given the provided _id values, or filters
|
67
|
+
# the documents in the current scope in the application process space
|
68
|
+
# after loading them if needed.
|
69
|
+
#
|
70
|
+
# If this method is not given a block, it delegates to +Findable#find+
|
71
|
+
# and finds one or many documents for the provided _id values.
|
72
|
+
#
|
73
|
+
# If this method is given a block, it delegates to +Enumerable#find+ and
|
74
|
+
# returns the first document of those found by the current Crieria object
|
75
|
+
# for which the block returns a truthy value.
|
76
|
+
#
|
77
|
+
# Note that the "default proc" argument of Enumerable is not specially
|
78
|
+
# treated by Mongoid - the decision between delegating to +Findable+ vs
|
79
|
+
# +Enumerable+ is made solely based on whether +find+ is passed a block.
|
80
|
+
#
|
81
|
+
# @example Finds a document by its _id, invokes Findable#find.
|
82
|
+
# critera.find("1234")
|
83
|
+
#
|
84
|
+
# @example Finds the first matching document using a block, invokes Enumerable#find.
|
85
|
+
# criteria.find { |item| item.name == "Depeche Mode" }
|
86
|
+
#
|
87
|
+
# @example Finds the first matching document using a block using the default Proc, invokes Enumerable#find.
|
88
|
+
# criteria.find(-> { "Default Band" }) { |item| item.name == "Milwaukee Mode" }
|
89
|
+
#
|
90
|
+
# @example Tries to find a document whose _id is the stringification of the provided Proc, typically failing.
|
91
|
+
# enumerator = criteria.find(-> { "Default Band" })
|
92
|
+
#
|
93
|
+
# @return [ Document | Array<Document> | nil ] A document or matching documents.
|
94
|
+
#
|
95
|
+
# @raise Errors::DocumentNotFound If the parameters were _id values and
|
96
|
+
# not all documents are found and the +raise_not_found_error+
|
97
|
+
# Mongoid configuration option is truthy.
|
98
|
+
#
|
99
|
+
# @see https://ruby-doc.org/core/Enumerable.html#method-i-find
|
100
|
+
def find(*args, &block)
|
101
|
+
if block_given?
|
102
|
+
_enumerable_find(*args, &block)
|
103
|
+
else
|
104
|
+
_findable_find(*args)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
58
108
|
# Needed to properly get a criteria back as json
|
59
109
|
#
|
60
110
|
# @example Get the criteria as json.
|
@@ -169,7 +219,7 @@ module Mongoid
|
|
169
219
|
# @since 2.0.0
|
170
220
|
def field_list
|
171
221
|
if options[:fields]
|
172
|
-
options[:fields].keys.reject{ |key| key ==
|
222
|
+
options[:fields].keys.reject{ |key| key == klass.discriminator_key }
|
173
223
|
else
|
174
224
|
[]
|
175
225
|
end
|
@@ -292,7 +342,7 @@ module Mongoid
|
|
292
342
|
args.unshift(:_id)
|
293
343
|
end
|
294
344
|
if klass.hereditary?
|
295
|
-
super(*args.push(
|
345
|
+
super(*args.push(klass.discriminator_key.to_sym))
|
296
346
|
else
|
297
347
|
super(*args)
|
298
348
|
end
|
@@ -379,7 +429,7 @@ module Mongoid
|
|
379
429
|
#
|
380
430
|
# @return [ Criteria ] The cloned criteria.
|
381
431
|
def type(types)
|
382
|
-
any_in(
|
432
|
+
any_in(self.discriminator_key.to_sym => Array(types))
|
383
433
|
end
|
384
434
|
|
385
435
|
# This is the general entry point for most MongoDB queries. This either
|
@@ -555,8 +605,8 @@ module Mongoid
|
|
555
605
|
# @since 3.0.3
|
556
606
|
def type_selectable?
|
557
607
|
klass.hereditary? &&
|
558
|
-
!selector.keys.include?(
|
559
|
-
!selector.keys.include?(
|
608
|
+
!selector.keys.include?(self.discriminator_key) &&
|
609
|
+
!selector.keys.include?(self.discriminator_key.to_sym)
|
560
610
|
end
|
561
611
|
|
562
612
|
# Get the selector for type selection.
|
@@ -572,9 +622,9 @@ module Mongoid
|
|
572
622
|
def type_selection
|
573
623
|
klasses = klass._types
|
574
624
|
if klasses.size > 1
|
575
|
-
{
|
625
|
+
{ klass.discriminator_key.to_sym => { "$in" => klass._types }}
|
576
626
|
else
|
577
|
-
{
|
627
|
+
{ klass.discriminator_key.to_sym => klass._types[0] }
|
578
628
|
end
|
579
629
|
end
|
580
630
|
|
@@ -38,7 +38,7 @@ module Mongoid
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
module
|
41
|
+
module Raw_
|
42
42
|
|
43
43
|
# Is the object a regexp?
|
44
44
|
#
|
@@ -77,5 +77,5 @@ end
|
|
77
77
|
|
78
78
|
::Regexp.__send__(:include,Mongoid::Criteria::Queryable::Extensions::Regexp)
|
79
79
|
::Regexp.__send__(:extend, Mongoid::Criteria::Queryable::Extensions::Regexp::ClassMethods)
|
80
|
-
BSON::Regexp::Raw.__send__(:include,Mongoid::Criteria::Queryable::Extensions::Regexp::
|
81
|
-
BSON::Regexp::Raw.__send__(:extend, Mongoid::Criteria::Queryable::Extensions::Regexp::
|
80
|
+
BSON::Regexp::Raw.__send__(:include,Mongoid::Criteria::Queryable::Extensions::Regexp::Raw_)
|
81
|
+
BSON::Regexp::Raw.__send__(:extend, Mongoid::Criteria::Queryable::Extensions::Regexp::Raw_::ClassMethods)
|
@@ -9,6 +9,18 @@ module Mongoid
|
|
9
9
|
# This module contains additional time with zone behavior.
|
10
10
|
module TimeWithZone
|
11
11
|
|
12
|
+
# Evolve the time as a date, UTC midnight.
|
13
|
+
#
|
14
|
+
# @example Evolve the time to a date query format.
|
15
|
+
# time.__evolve_date__
|
16
|
+
#
|
17
|
+
# @return [ Time ] The date at midnight UTC.
|
18
|
+
#
|
19
|
+
# @since 1.0.0
|
20
|
+
def __evolve_date__
|
21
|
+
::Time.utc(year, month, day, 0, 0, 0, 0)
|
22
|
+
end
|
23
|
+
|
12
24
|
# Evolve the time into a utc time.
|
13
25
|
#
|
14
26
|
# @example Evolve the time.
|
@@ -33,7 +33,7 @@ module Mongoid
|
|
33
33
|
#
|
34
34
|
# A yet more more complex example is the following condition:
|
35
35
|
#
|
36
|
-
# Foo.
|
36
|
+
# Foo.geo_spatial(:boundary.intersects_point => [1, 10])
|
37
37
|
#
|
38
38
|
# Processing this condition will cause a Key instance to be created as
|
39
39
|
# follows:
|