Don't save non-changes to content history



When a default value for a document is different from the value in the database, the content history detects this as a change. But Doctrine doesn't write the change to the database.

This means it keeps generating records in the content history.

Example 1: phone number in database doesn't have a type

Example 2: reference has wrong db (it would be better to turn storage of $db off, this will be the default in Doctrine ODM 2,

Note: also when the changeset is empty a record is sometimes written to the content history.


  • $db

    • ignore in ArrayComparer

  • Empty values

    • Values that are not set, are set with "null", so this problem is not present for the first level. This does however not work for values with multiple levels, so this check should be recursive.

Technical tasks


Deployment actions



Marijn Otte
May 22, 2018, 10:35 AM

Go to:

Enable en disable "Write channel" and "Enforced channel" + save a few times. 500 error:

[2018-05-22 12:30:35] request.CRITICAL: Uncaught PHP Exception MongoResultException: "invalid document for insert: keys cannot begin with "$": "$id"" at /home/integrated-latest/vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/ExceptionConverter.php line 83 {"exception":"[object] (MongoResultException(code: 22): invalid document for insert: keys cannot begin with \"$\": \"$id\" at /home/integrated-latest/vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/ExceptionConverter.php:83, MongoDB\\Driver\\Exception
InvalidArgumentException(code: 22): invalid document for insert: keys cannot begin with \"$\": \"$id\" at /home/integrated-latest/vendor/mongodb/mongodb/src/Operation/InsertMany.php:130)"} []

Marijn Otte
May 22, 2018, 10:42 AM
  • Remove the field "content" from the document. Open the document, do not change anything. Content is added to the changeset, but shouldn't.

  • When saving a document without changing anything, time fields like createdAt are added (while they have the same value)

Jeroen van Leeuwen
June 12, 2018, 5:02 AM


Jeroen van Leeuwen
June 12, 2018, 6:20 AM

check again what should we do with this issue?

Gerben Bosch
June 19, 2018, 9:50 AM

Ik heb dit issue even op de radar om voor te bereiden voor de sprintreview. Volgens mij is dit het issue waar geen goede oplossing voor te vinden was en de gekozen oplossing werkte niet.

Heb jij wellicht nog wat input, hoe we kunnen voorkomen dat dit weer gebeurd en waarom jou oplossing niet werkte?



External issue ID



Integrated Marijn

Min. hours


Dev hour estimate


Epic Link



Fix versions