Mongo export not working on crontab and working fine in manually

Tag: mongodb , mongoid , mongoose Author: nb235828577 Date: 2013-09-30
Here is the code in the script export_coll.sh
start=1381459177964 
query="{\"conn_time\":{\"\$gte\":Date($start)}}"
mongoexport --csv --out $ARCHIVE/aud_createcoll_log.csv --host $DB_HOST:$MONGO_PORT --db $DB --collection collection_log -q $query --fields field1, conn_time, field3, field4 -u <username> -p <pwd> -v

We have to implement a Mongo export job as follows:
*/1 * * * * /home/mongod/control_sampling/export_coll.sh >/home/mongod/control_sampling/export_coll.log 2>&1
When the job runs, we get this error:
Fri Oct 11 05:31:02 Assertion: 10340:Failure parsing JSON string near: "conn_time
0x587b12 0x5296f4 0x529a6e 0xa9f691 0xa98e7d 0xa9ce42 0x2b9488a95994 0x4fdca9 
mongoexport(_ZN5mongo11msgassertedEiPKc+0x112) [0x587b12]
mongoexport(_ZN5mongo8fromjsonEPKcPi+0x444) [0x5296f4]
mongoexport(_ZN5mongo8fromjsonERKSs+0xe) [0x529a6e]
mongoexport(_ZN6Export3runEv+0x7b1) [0xa9f691]
mongoexport(_ZN5mongo4Tool4mainEiPPc+0x169d) [0xa98e7d]
mongoexport(main+0x32) [0xa9ce42]
/lib64/libc.so.6(__libc_start_main+0xf4) [0x2b9488a95994]
mongoexport(__gxx_personality_v0+0x3d1) [0x4fdca9]
assertion: 10340 Failure parsing JSON string near: "conn_time
The script runs fine when executed manually:

Manually this script is working fine but while running on crontab using shell not working as expected

Try using single quotes for query='{"conn_time": {"$gte": Date('$start')}}'