How to convert mongo db json object to csv file

Quickly scribbled a function to get a plain csv out of mongo db json object. Use the script as you would call any shell script. sh mongo_command.sh > social_data_tmp.csv The mongo_command.sh has all the required mongo code, Something like – mongo << EOF function printUserDetails(user){ if (user == undefined){ return; } print(user._id+’,’+ user.email+’,’+ user.birthday+’,’+ ((user.homeTown …

More

Querying MongoDB via Apache Pig

This crisp post in on querying MongoDB for HDFS Data Transfer, via Pig. Below are the steps involved for the same: 1. Install MongoDB on box a. Download MongoDB binaries b. Extract mongodb and export bin path to $PATH c. create db dir for mongodb d. start mongodb by the command : mongod –dbpath INFO: …

More