Skip to content

QueryCursor.js is throwing an error on line 144: "TypeError: Cannot assign to read only property 'map' of object '#<QueryCursor>'" #11377

Closed
@balonsom

Description

@balonsom

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

QueryCursor.js is throwing an error on line 144:

QueryCursor.prototype.map = function(fn) {

Trying to assign to read only property 'map' of object

TypeError: Cannot assign to read only property 'map' of object '#<QueryCursor>'
    at Object.<anonymous> (/Users/balonsom/Documents/repos/dungeon-master/node_modules/mongoose/lib/cursor/QueryCursor.js:144:27)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/balonsom/Documents/repos/dungeon-master/node_modules/mongoose/lib/query.js:12:21)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)

If the current behavior is a bug, please provide the steps to reproduce.

This bug only arose when I upgrade Node.js to v17.5.0. I don't think I can easily provide a script to replicate.

What is the expected behavior?

QueryCursor.js should not throw an error.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

Mongoose: 6.2.1
Node.js: 17.5.0
MongoDB: 4.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs repro scriptMaybe a bug, but no repro script. The issue reporter should create a script that demos the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions