From 9339bcd1545661d6398b5d787984af374773dff6 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 4 Feb 2025 09:46:12 -0500 Subject: [PATCH] docs(document): clarify that toObject() returns a POJO that may contain non-POJO values Fix #15208 --- lib/document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/document.js b/lib/document.js index 9554c3a811..190d74cc0a 100644 --- a/lib/document.js +++ b/lib/document.js @@ -4069,7 +4069,7 @@ Document.prototype.$__toObjectShallow = function $__toObjectShallow() { * @param {Boolean} [options.flattenMaps=false] if true, convert Maps to POJOs. Useful if you want to `JSON.stringify()` the result of `toObject()`. * @param {Boolean} [options.flattenObjectIds=false] if true, convert any ObjectIds in the result to 24 character hex strings. * @param {Boolean} [options.useProjection=false] - If true, omits fields that are excluded in this document's projection. Unless you specified a projection, this will omit any field that has `select: false` in the schema. - * @return {Object} js object (not a POJO) + * @return {Object} document as a plain old JavaScript object (POJO). This object may contain ObjectIds, Maps, Dates, mongodb.Binary, Buffers, and other non-POJO values. * @see mongodb.Binary https://mongodb.github.io/node-mongodb-native/4.9/classes/Binary.html * @api public * @memberOf Document