{"issue":{"milestone":{"title":"2.4.0","open_issues":14,"created_at":"2011-10-06T16:38:59Z","creator":{"id":9030,"login":"durran","url":"https://api.github.com/users/durran","avatar_url":"https://secure.gravatar.com/avatar/6f09262a13427532461b0b618d445b1e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"6f09262a13427532461b0b618d445b1e"},"state":"open","due_on":"2011-12-19T08:00:00Z","closed_issues":32,"number":27,"description":"","url":"https://api.github.com/repos/mongoid/mongoid/milestones/27"},"user":{"id":426230,"login":"Mik-die","url":"https://api.github.com/users/Mik-die","avatar_url":"https://secure.gravatar.com/avatar/7d116b912a4fc7986b40d5d0d0d811d6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"7d116b912a4fc7986b40d5d0d0d811d6"},"title":"With #only limitation, other fields return default value (if present), instead of nil","created_at":"2011-09-01T05:21:26Z","updated_at":"2011-12-17T10:06:19Z","labels":[{"name":"enhancement","url":"https://api.github.com/repos/mongoid/mongoid/labels/enhancement","color":"0b02e1"}],"state":"open","id":1538302,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"html_url":"https://github.com/mongoid/mongoid/issues/1205","closed_at":null,"body":"So, if we have document:\r\n\r\n```ruby\r\nclass Person\r\n  include Mongoid::Document\r\n  field :name\r\n  field :surname, default: 'Smith'\r\n  field :age, type: Integer\r\nend\r\n```\r\n\r\nThen\r\n\r\n```ruby\r\nPerson.create name: 'James', surname: 'Bond', age: 45\r\nman_without_name = Person.only(:age).first\r\nman_without_name.age  #=> 45\r\nman_without_name.name  #=> nil\r\nman_without_name.surname  #=>  'Smith'\r\n```\r\n\r\nI think all fields with default value in this case should return nil, as for fields without default value. ","number":1205,"url":"https://api.github.com/repos/mongoid/mongoid/issues/1205","comments":2,"assignee":null},"comment":{"user":{"id":9030,"login":"durran","url":"https://api.github.com/users/durran","avatar_url":"https://secure.gravatar.com/avatar/6f09262a13427532461b0b618d445b1e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"6f09262a13427532461b0b618d445b1e"},"created_at":"2011-12-17T10:06:19Z","updated_at":"2011-12-17T10:06:19Z","id":3188658,"body":"While there is no performance penalty for this, the problem arises if the database values differ from the defaults, so if this document gets saved, the defaults are going to override.","url":"https://api.github.com/repos/mongoid/mongoid/issues/comments/3188658"},"action":"created"}