Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-469

mongoexport $or query reporting zero records

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.8.0-rc4
    • Affects Version/s: None
    • Component/s: mongoexport
    • Labels:
      None
    • Environment:
      bash
    • 2014 Last MCI Iteration

      I have the following cmd in bash termial

      mongoexport --db fscrap --collection Wall -q "{\$or : [{'insert_time' : {\$gte : new Date(1393624800000)} },{'comments.comment_time' : {\$gte : new Date(1393624800000)}}]}" --out test.json
      it returns zero records while in mongo shell I get the result expected ~ 300 records

      note that I escaped the $ and

      echo "{\$or : [{'insert_time' : {\$gte : new Date(1393624800000)} },{'comments.comment_time' : {\$gte : new Date(1393624800000)}}]}"
      returns

      {$or : [{'insert_time' : {$gte : new Date(1393624800000)} },{'comments.comment_time' : {$gte : new Date(1393624800000)}}]}
      query works in mongo shell

      > db.Wall.find({$or : [{'insert_time' : {$gte : new Date(1393624800000)} },{'comments.comment_time' : {$gte : new Date(1393624800000)}}]}).count()
      328
      SOLVED by downgrading from mongo 2.7.8 (dev version) to stable version 2.6.5

      http://stackoverflow.com/questions/27334866/mongodb-mongoexport-or-query-returns-zero-records

            Assignee:
            mikeo@mongodb.com Michael O'Brien
            Reporter:
            y0ft88 Yoft
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: