#!/usr/bin/env node

//importing JSON from req-json-lastfm.js
//var reqJsonLastfm = require('./req-json-lastfm');
//storing JSON from req-json-lastfm.js
//var jsonStringify = reqJsonLastfm.jsonStringify;

//importing concert.json file
//var concert = require('./concerts/');
//var dir = requireDir('./concerts');
//var directory = require('./concerts');
//var util = require('util');
var mongoExpress = require('mongo-express');

var Db = require('mongodb').Db;
var Server = require('mongodb').Server;

//establishing new connection
var client = new Db('test', new Server('127.0.0.1', 27017), {safe:false});

//function to insert data into default collection
var insertData = function(err, collection){
    //collection.insert({name: 'something'});
    //collection.insert(concert);
    require("fs").readdirSync("./concerts").forEach(function(file, i) {
            var test = [];
            test[i] = require("./concerts/" + file);
            //console.log('index.js:' + util.inspect(test[i]));
            collection.insert(test[i]);
        });
};

//function to list all data in default collection
var listAllData = function(err, collection){
    collection.find().toArray(function(err, results){
        console.log(results);
        client.close();
    });
};

//opening dataBase 
client.open(function(err,pClient){
    if(!err){
        console.log('concert: ');
        //calling function insertData on collection 'test'
        client.collection("test", insertData);
        console.log('fin de insert ');
        //calling fucntion listAllDta on collection 'test'
        client.collection('test', listAllData);
    }
    else console.log('\n ***error occured in node-mongodb.js***');
});

@@ -20,368 +20,22 @@
 %0A%0A//
-importing JSON from req-json-lastfm.js%0A//var reqJsonLastfm = require('./req-json-lastfm');%0A//storing JSON from req-json-lastfm.js%0A//var jsonStringify = reqJsonLastfm.jsonStringify;%0A%0A//importing concert.json file%0A//var concert = require('./concerts/');%0A//var dir = requireDir('./concerts');%0A//var directory = require('./concerts');%0A//var util = require('util');
+Visual mongoDB
 %0Avar

Update node-mongo.js clean version1