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

  • Home
  • SEARCH
  • 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 8335083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:33:27+00:00 2026-06-09T03:33:27+00:00

Trying to use a query with mongoexport results in an error. But the same

  • 0

Trying to use a query with mongoexport results in an error. But the same query is evaluated by the mongo-client without an error.

In mongo-client:

db.listing.find({"created_at":new Date(1221029382*1000)})

with mongoexport:

mongoexport -d event -c listing -q '{"created_at":new Date(1221029382*1000)}'

The generated error:

Fri Nov 11 17:44:08 Assertion: 10340:Failure parsing JSON string near: 
$and: [ { 
0x584102 0x528454 0x5287ce 0xa94ad1 0xa8e2ed 0xa92282 0x7fbd056a61c4 
0x4fca29 
mongoexport(_ZN5mongo11msgassertedEiPKc+0x112) [0x584102] 
mongoexport(_ZN5mongo8fromjsonEPKcPi+0x444) [0x528454] 
mongoexport(_ZN5mongo8fromjsonERKSs+0xe) [0x5287ce] 
mongoexport(_ZN6Export3runEv+0x7b1) [0xa94ad1] 
mongoexport(_ZN5mongo4Tool4mainEiPPc+0x169d) [0xa8e2ed] 
mongoexport(main+0x32) [0xa92282] 
/lib/libc.so.6(__libc_start_main+0xf4) [0x7fbd056a61c4] 
mongoexport(__gxx_personality_v0+0x3d9) [0x4fca29] 
assertion: 10340 Failure parsing JSON string near: $and: [ {

But doing the multiplication in Date beforehand in mongoexport:

mongoexport -d event -c listing -q '{"created_at":new Date(1221029382000)}'

works!

Why is mongo evaluating the queries differently in these two contexts?

  • 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-09T03:33:30+00:00Added an answer on June 9, 2026 at 3:33 am

    The mongoexport command-line utility supports passing a query in JSON format, but you are trying to evaluate JavaScript in your query.

    The JSON format was originally derived from JavaScript’s object notation, but the contents of a JSON document can be parsed without eval()ing it in a JavaScript interpreter.

    You should consider JSON as representing “structured data” and JavaScript as “executable code“. So there are, in fact, two different contexts for the queries you are running.

    The mongo command-line utility is an interactive JavaScript shell which includes a JavaScript interpreter as well as some helper functions for working with MongoDB. While the JavaScript object format looks similar to JSON, you can also use JavaScript objects, function calls, and operators.

    Your example of 1221029382*1000 is the result of a math operation that would be executed by the JavaScript interpreter if you ran that in the mongo shell; in JSON it’s an invalid value for a new Date so mongoexport is exiting with a “Failure parsing JSON string” error.

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

Sidebar

Related Questions

I'm trying to use Subsonic 3.0 but with every query I try it gives
I am getting an error when trying to use linqsql query: LINQ to Entities
For some reason I am unable to use query results in the same function
I am trying to use this query upon my Android database, but it does
I' trying to use a Linq query to find and set the selected value
I'm trying to use custom query in Cake then paginate the results with the
I am trying to use an sql query but i get multiple times the
I want to get latest two posts. I'm trying to use following query, but
I'm trying to use the advanced query syntax as linked in the Search documentation.
I am trying to use an update query to update the first 3 characters

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.