Skip to content

Commit 8223f91

Browse files
committed
refactor: rename to $__toObjectShallow() based on code review comments
1 parent 9dc2e8a commit 8223f91

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/document.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,7 +3866,7 @@ Document.prototype.$toObject = function(options, json) {
38663866
if (hasOnlyPrimitiveValues && !options.flattenObjectIds) {
38673867
// Fast path: if we don't have any nested objects or arrays, we only need a
38683868
// shallow clone.
3869-
ret = this.$__toObjectInternal();
3869+
ret = this.$__toObjectShallow();
38703870
} else {
38713871
ret = clone(this._doc, options) || {};
38723872
}
@@ -3931,7 +3931,7 @@ Document.prototype.$toObject = function(options, json) {
39313931
* Internal shallow clone alternative to `$toObject()`: much faster, no options processing
39323932
*/
39333933

3934-
Document.prototype.$__toObjectInternal = function $__toObjectInternal() {
3934+
Document.prototype.$__toObjectShallow = function $__toObjectShallow() {
39353935
const ret = {};
39363936
if (this._doc != null) {
39373937
for (const key of Object.keys(this._doc)) {

lib/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2954,7 +2954,7 @@ Model.$__insertMany = function(arr, options, callback) {
29542954
doc.initializeTimestamps();
29552955
}
29562956
if (doc.$__hasOnlyPrimitiveValues()) {
2957-
return doc.$__toObjectInternal();
2957+
return doc.$__toObjectShallow();
29582958
}
29592959
return doc.toObject(internalToObjectOptions);
29602960
});

0 commit comments

Comments
 (0)