-
Type: New Feature
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 7.0.5
-
Component/s: Attributes
-
None
-
Environment:MongoDB 3.6, Rails 5.2.1, Mongoid 7.0.5
-
Fully Compatible
Original title: A field called "id" can not be set or updated with Document#create or Document#update
I am trying to access an existing database, which has an "id" field that is separate from the "_id" field, and is application managed.
My document definition looks like this:
class Instance include Mongoid::Document self.aliased_fields.delete("id") # see MONGOID-2031 store_in collection: 'app_instances' field :id, type: String field :name, type: String field :update_time, type: Float end
With this code, querying works, at least, but inserting/updating does not.
Is there a similar monkey patch to the one recommended in MONGOID-2031, or would this be even more of a mess?
- related to
-
MONGOID-5225 Updating embedded docs with a different _id is not working in 7.3
- Closed
- links to