Skip to content

WIP: Use Mongoose object._id in place of object.id so we can use POJO

Eric Eastwood requested to merge use-mongoose-_id-property-in-place-of-id into develop

Use Mongoose object._id in place of object.id so we can use POJO JSON objects with the fixture users. Because of the nature of this change, it also just fixes up a lot of places we weren't using mongoUtils.objectIDsEqual

Part of https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1480

See https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1480/diffs?diff_id=48532172#cef48dbc72052faf3a4c14758b88b8950d3e97d8_99_99

modules/test-utils/lib/create-users.js

+   .then(async function() {
+     const user = await User.create(doc);
+    // We convert to a plain object so when we add properties like accessToken below,
+    // so it properly serializes in our `/api/private/seed` endpoint
+    return user.toJSON();
+  });

POJO: Plain-old JavaScript object

lean, json

Edited by Eric Eastwood

Merge request reports