Skip to content

Commit cf576fc

Browse files
authored
Update document.js
1 parent 294d287 commit cf576fc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/document.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1020,9 +1020,6 @@ Document.prototype.overwrite = function overwrite(obj) {
10201020
*/
10211021

10221022
Document.prototype.$set = function $set(path, val, type, options) {
1023-
if (path._id && path.id) {
1024-
delete path.id;
1025-
}
10261023
if (utils.isPOJO(type)) {
10271024
options = type;
10281025
type = undefined;
@@ -1063,6 +1060,10 @@ Document.prototype.$set = function $set(path, val, type, options) {
10631060
[path, val] = [val, path];
10641061
}
10651062

1063+
if ('_id' in path && 'id' in path) {
1064+
delete path.id;
1065+
}
1066+
10661067
prefix = val ? val + '.' : '';
10671068
keys = getKeysInSchemaOrder(this.$__schema, path);
10681069

0 commit comments

Comments
 (0)