Replaced loops in collections with collection.findById