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, http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/reference-mapping.html)
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.
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)"} []
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)
check!
check again what should we do with this issue?
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?