var data = JSON.parse(fs.readFileSync(filePath));
fs.readFile(filePath, function (error, content) { var data = JSON.parse(content); console.log(data.collection.length); });