@researchdatabox/sails-hook-redbox-storage-mongo 1.4.8 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -146,6 +146,7 @@ var Services;
146
146
  _.unset(record, 'dateCreated');
147
147
  _.unset(record, 'lastSaveDate');
148
148
  _.unset(record, '_id');
149
+ _.unset(record, 'id');
149
150
  yield Record.updateOne({ redboxOid: oid }).set(record);
150
151
  response.success = true;
151
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@researchdatabox/sails-hook-redbox-storage-mongo",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "description": "A MongoDB storage plugin for ReDBox.",
5
5
  "main": "index.js",
6
6
  "sails": {
@@ -153,6 +153,12 @@ export module Services {
153
153
  _.unset(record, 'dateCreated');
154
154
  _.unset(record, 'lastSaveDate');
155
155
  _.unset(record, '_id');
156
+
157
+ // Records with an 'id' property fail to save with error:
158
+ // {"cause":{"name":"AdapterError","adapterMethodName":"update","modelIdentity":"record","raw":{"code":"E_CANNOT_INTERPRET_AS_OBJECTID"}},"isOperational":true}
159
+ // Fix by ensuring the 'id' property is removed.
160
+ _.unset(record, 'id');
161
+
156
162
  await Record.updateOne({ redboxOid: oid }).set(record);
157
163
  response.success = true;
158
164
  } catch (err) {