-
Notifications
You must be signed in to change notification settings - Fork 4
MongoDB insert script
Martin H. Bramwell edited this page Oct 16, 2015
·
3 revisions
export MONGO_SERVER="ds039684.mongolab.com"
export MONGO_PORT=39684
export MONGO_DB="ci4m"
export MONGO_UID="ci4m"
export MONGO_PATH=mongodb://${MONGO_UID}:${MONGO_PWD}@${MONGO_SERVER}:${MONGO_PORT}/${MONGO_DB}
export MONGO_URL=mongodb://${MONGO_PATH}
export REC01='{"text": "AA", "createdAt": new Date("04-16-2013")}'
export REC02='{"text": "BB", "createdAt": new Date("04-16-2013")}'
export INS01="[${REC01}, ${REC02}]"
function testMongoScript {
mongo $1 <<EOF
db.tasks.insert( $2 )
EOF
}
testMongoScript ${MONGO_URL} ${INS01}