Mongodb upsert only update selected fields, but insert all
问题 I am trying to use upsert in MongoDB to update a single field in a document if found OR insert a whole new document with lots of fields. The problem is that it appears to me that MongoDB either replaces every field or inserts a subset of fields in its upsert operation, i.e. it can not insert more fields than it actually wants to update. What I want to do is the following: I query for a single unique value If a document already exists, only a timestamp value (lets call it 'lastseen') is