remove function, return something

11 views
Skip to first unread message

Jean Carlo

unread,
Nov 5, 2012, 3:05:39 PM11/5/12
to mongod...@googlegroups.com
Is there a way to confirm, in a shell script code, that a  remove command has removed data?

I have the following bash code

query="db.external_outbox_received_history.remove({ \"exp_date\":{\"\$lte\":1351987200000,\"\$gte\":1351814400000}})"
host="hostname"
db="database"
port=23234
return=`mongo ${host}:${port}/${db} --eval "$query" `

how can I see that the data was in fact removed or something wrong happened and the data could not be removed?

maybe something like this

//pseudo code
if(return==true)
    success
else
    handler
fi

Jean Carlo

unread,
Nov 5, 2012, 4:51:32 PM11/5/12
to mongod...@googlegroups.com
If someone need the same information, we need to parse the information of getLastError of mongo 

=)  happy coding
Reply all
Reply to author
Forward
0 new messages