Gets all nodes from mongodb and puts it in JSON