[SERVER-19169] friendlyEqual is not defined Created: 27/Jun/15  Updated: 06/Dec/22  Resolved: 04/Feb/22

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: 2.6.10, 3.0.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Steve Ardis Assignee: Backlog - Query Optimization
Resolution: Done Votes: 1
Labels: platforms-re-triaged, query-44-grooming
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query Optimization
Operating System: ALL
Steps To Reproduce:

Create a collection named "test" and run the MapReduce above.

Participants:

 Description   

The following contrived MapReduce:

db.test.mapReduce(
    function() {
        var map = new Map()
        map.put("A", "B")
 
        emit(map.get("A"), { count: 1 })
    },
    function(key, records) { 
        counter = { count: 0 }
        
        for (var idx = 0; idx < records.length; idx++) {
            counter.count += records[idx].count
        }
        
        return counter
    },
    { 
      out: { inline: 1 }
    }
)

displays the following error:

uncaught exception: map reduce failed:{
	"errmsg" : "exception: ReferenceError: friendlyEqual is not defined\n    at Map._get (src/mongo/shell/types.js:516:13)\n    at Map.get (src/mongo/shell/types.js:505:17)\n    at _funcs1 (_funcs1:4:14) at src/mongo/shell/types.js:516",
	"code" : 16722,
	"ok" : 0
}

It would appear to me that perhaps utils.js is not loaded?



 Comments   
Comment by Esha Bhargava [ 04/Feb/22 ]

Closing these tickets as part of the deprecation of mapReduce.

Comment by Gábor Mező [ 29/Sep/21 ]

Dear all,

I think this issue is urgent, because aggregation functions an accumulators are affected by this too. The implementation of the Map is extremely outdated in types.js compared to once-was-recent ES standards.

I'm getting this by using aggregate as of MongoDB 5.0.3. It is not a miracle, because I can see what resides in types.js atm.

Side note: it is a pain of not having .set() method on maps too. Please fix.

Comment by Sam Kleinman (Inactive) [ 30/Jun/15 ]

Thanks for the report.

I was able to reproduce this in 2.6.10 as well as 3.0.4.

Generated at Thu Feb 08 03:50:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.