Tried updating two different fields and it still conflicts, because the different ObjectId's are being compared in these places:
https://github.com/aerogear/graphback/blob/98826cc129901da4b8c88c9798ebdfce9f90db78/packages/graphback-datasync/src/providers/DataSyncConflictProvider.ts#L135
https://github.com/aerogear/graphback/blob/98826cc129901da4b8c88c9798ebdfce9f90db78/packages/graphback-datasync/src/providers/DataSyncConflictProvider.ts#L140
On debugging:
> base._id === serverData._id
false
> base._id.toString() === serverData._id.toString()
true
Automatically generated comment to notify maintainers
/cc @craicoverflow, @machi1990, @wtrocki
Is this in the MongoDB provider? At runtime can you know if it is an ObjectID?
Would ObjectId.equals work? https://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html
@craicoverflow Really sorry for giving so little context!
I think just adding it to the ignoredKeys would do the job. This would be correct because both base and serverData are fetched according to the _id sent by the client, and are guaranteed to have the same _id so there is no need to compare these in the first place. Quick fix, I'll push this in some time.
https://github.com/aerogear/graphback/blob/98826cc129901da4b8c88c9798ebdfce9f90db78/packages/graphback-datasync/src/providers/DataSyncConflictProvider.ts#L124
https://github.com/aerogear/graphback/blob/98826cc129901da4b8c88c9798ebdfce9f90db78/packages/graphback-datasync/src/providers/DataSyncConflictProvider.ts#L132-L144
Looks like it can be closed.
Most helpful comment
@craicoverflow Really sorry for giving so little context!
I think just adding it to the
ignoredKeyswould do the job. This would be correct because bothbaseandserverDataare fetched according to the_idsent by the client, and are guaranteed to have the same_idso there is no need to compare these in the first place. Quick fix, I'll push this in some time.https://github.com/aerogear/graphback/blob/98826cc129901da4b8c88c9798ebdfce9f90db78/packages/graphback-datasync/src/providers/DataSyncConflictProvider.ts#L124
https://github.com/aerogear/graphback/blob/98826cc129901da4b8c88c9798ebdfce9f90db78/packages/graphback-datasync/src/providers/DataSyncConflictProvider.ts#L132-L144