Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7710831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:13:19+00:00 2026-06-01T01:13:19+00:00

I am trying to run group command via mongo shell db.contract.group({ key:{id: 1}, initial:

  • 0

I am trying to run group command via mongo shell

db.contract.group({
   key:{id: 1}, 
   initial: {v: []}, 
   reduce: function(obj, prev){ 
     prev.v.push(obj.name)
   } 
});

and see the following error on client

Thu Nov 17 12:12:49 uncaught exception: group command failed: {
    "errmsg" : "exception: JS_NewObject failed: toJSObject2",
    "code" : 13072,
    "ok" : 0
}

and mongod logs says the following

Thu Nov 17 12:12:17 [initandlisten] connection accepted from 127.0.0.1:58509 #1
Thu Nov 17 12:12:49 [conn1] JS Error: out of memory
Thu Nov 17 12:12:49 [conn1] Assertion: 13072:JS_NewObject failed: toJSObject2
0x10008de9b 0x1001565bd 0x100156c9e 0x10037011e 0x10037204c 0x10034c4d6 0x10034d877 0x100180cc4 0x100184649 0x1002b9e89 0x1002c3f18 0x100433888 0x100446d74 0x7fff86e00fd6 0x7fff86e00e89 
 0   mongod                              0x000000010008de9b _ZN5mongo11msgassertedEiPKc + 315
 1   mongod                              0x00000001001565bd _ZN5mongo9Convertor10toJSObjectEPKNS_7BSONObjEb + 1229
 2   mongod                              0x0000000100156c9e _ZN5mongo7SMScope9setObjectEPKcRKNS_7BSONObjEb + 78
 3   mongod                              0x000000010037011e _ZN5mongo12GroupCommand5groupESsRKSsRKNS_7BSONObjES3_SsSsPKcS3_SsRSsRNS_14BSONObjBuilderE + 2110
 4   mongod                              0x000000010037204c _ZN5mongo12GroupCommand3runERKSsRNS_7BSONObjERSsRNS_14BSONObjBuilderEb + 3676
 5   mongod                              0x000000010034c4d6 _ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 1350
 6   mongod                              0x000000010034d877 _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_10BufBuilderERNS_14BSONObjBuilderEbi + 2151
 7   mongod                              0x0000000100180cc4 _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_10BufBuilderERNS_14BSONObjBuilderEbi + 52
 8   mongod                              0x0000000100184649 _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 10585
 9   mongod                              0x00000001002b9e89 _ZN5mongo13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 569
 10  mongod                              0x00000001002c3f18 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_8SockAddrE + 1528
 11  mongod                              0x0000000100433888 _ZN5mongo10connThreadEPNS_13MessagingPortE + 616
 12  mongod                              0x0000000100446d74 thread_proxy + 132
 13  libSystem.B.dylib                   0x00007fff86e00fd6 _pthread_start + 331
 14  libSystem.B.dylib                   0x00007fff86e00e89 thread_start + 13
Thu Nov 17 12:12:49 [conn1] query staging.$cmd ntoreturn:1 command: { group: { key: { asset_id: 1.0 }, initial: { v: {} }, ns: "contract", $reduce: function (obj, prev) {
    prev.v.push(obj.name);
} } } reslen:119 21013ms

I tried checking if the virtual memory is unlimited and it is

bash-3.2$ ulimit -a | egrep virtual\|open
open files                      (-n) 256
virtual memory          (kbytes, -v) unlimited

so I am not sure how to fix this problem

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:13:21+00:00Added an answer on June 1, 2026 at 1:13 am

    Mongo is grouping in memory, so if you have a large database with many different values for id things might get too big.

    Also you are piling up all names for a given id in one array. There is also a limit for the maximum document size in Mongo which might be the reason for the out of memory error if you have many docs for a given id.

    I guess the solution is to use map/reduce instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to run a command on the AddUserToGroup method via webservices (UserGroup.asmx). I
Trying to run the following command in php to run powershell command... the following
Trying to run Jison unit tests, but the command fails. How do I fix
Im trying to run a shell with cakephp but I'm not able to do
I am trying to get permissions of a directory via FTP command STAT like
I trying to run my jamsine specs from command line using PhantomJs.exe. Here is
I'm trying to run the following Web Deploy command: msdeploy.exe -verb:dump -source:dirPath=C:\Deploy,wmsvc=localhost,username=<user>,password=<pass> I have
I'm trying to run a Move-Mailbox powershell command when I hit enter to run
I am trying to compile and run a program from the command line. When
I am trying to run the wsdl2java command on a WSDL file that was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.