Fixed database.collection problems with MongoDB and added agentsController script