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 7565041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:02:58+00:00 2026-05-30T14:02:58+00:00

I am trying to run the following command via the mongo Java API –

  • 0

I am trying to run the following command via the mongo Java API – MapReduceCommand class. During debug time the MapReduceCommand mrc seems to hold the following.

{ "mapreduce" : "inColl" , "map" : "function mapf(){var vr = new Date(this.reg_d.getFullYear(),this.reg_d.getMonth(),this.reg_d.getDate());var key = {seg_dt:vr,com: this.com}emit(key,{count:1});}" , "reduce" : "function reducef(key, values){var r = {count:0};values.forEach(function(v){r.count += v.count;});return r;}" , "verbose" : true , "out" : { "reduce" : "outColl"} , "query" : { "tp" : { "$in" : [ 1 , 0]}} , "finalize" : "function finalizef(key, value){var r = {com:key.com,ou_ke:0,seg_dt:key.seg_dt};r.ou_ke += value.count ;return r;}"}

When I do a MapReduceOutput = inColl.mapreduce(mrc);, I get the following error

Mon Feb 27 23:39:49 [conn48] building new index on { 0: 1 } for >djkdb.tmp.mr.inColl_outColl_15_inc
Mon Feb 27 23:39:49 [conn48] done for 0 records 0secs
Mon Feb 27 23:39:49 [conn48] building new index on { _id: 1 } for >djkdb.tmp.mr.inColl_outColl_15_inc
Mon Feb 27 23:39:49 [conn48] done for 0 records 0secs
Mon Feb 27 23:39:51 [conn47] JS Error: SyntaxError: missing ; before statement nofile_b:0
Mon Feb 27 23:39:51 [conn47] compile failed for: function mapf(){var vr = new >Date(this.reg_d.getFullYear(),this.reg_d.getMonth(),this.reg_d.getDate());var key = >{seg_dt:vr,com: this.com}emit(key,{count:1});}
Mon Feb 27 23:39:51 [conn47] mr failed, removing collection

Is this a javascript syntax issue or am I missing something fundamental here ?

Thanks!

  • 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-05-30T14:02:59+00:00Added an answer on May 30, 2026 at 2:02 pm

    Looks like you have a syntax error:

    function mapf(){
        var vr = new Date(this.reg_d.getFullYear(),this.reg_d.getMonth(),this.reg_d.getDate());
        var key = {seg_dt:vr,com: this.com}  <--- syntax problem
        emit(key,{count:1});
    }
    

    You are missing an semi-colon on line 3.

        var key = {seg_dt:vr,com: this.com}
    

    My tip-off here was the error message:

    [conn47] JS Error: SyntaxError: missing ; before statement 
    

    I would suggest using something to help with formatting your code. Simply adding appropriate carriage made the mistake quite clear.

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

Sidebar

Related Questions

Trying to run the following command in php to run powershell command... the following
I'm trying to run the following command: find . -iname '.#*' -print0 | xargs
I'm trying to run the following command in terminal on my macbook pro cd
i am trying to run the following command to get the IP of a
I am trying to run the following command: [root@localhost certs]# openssl s_client -connect localhost:7043
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
Im trying to run a command on the AddUserToGroup method via webservices (UserGroup.asmx). I
I'm trying to run a Django management command via a crontab installed to /etc/cron.d/mycron
I'm trying to run the following command using the 'exec' task in Ant: ls
I'm trying to run the following commands: replace -x must A2input.txt replace -x a

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.