Dr. McCoy uses the Great Teacher

The Great Teacher of All the Ancient Knowledge was a machine, part of the ancient civilization located deep underground on the planet Sigma Draconis VI.

It consisted of a complex computer interface and a large, clear helmet containing many metallic appliances. These feeder circuits connected directly to the brain of anyone who placed their head under this helmet. The Teacher automatically activated whenever someone placed their head in the helmet, but according to Spock, its use was strictly predetermined by the builders, suggesting that even the leader of the Eymorgs would only use the Teacher when somehow instructed to do so. In less than a minute, the Teacher transferred vast amounts of knowledge to the user, but unfortunately this knowledge did not last. According to the Eymorg Kara the knowledge persisted for about three hours.

The Teacher's feeder circuits were optimized for the configurations of an Eymorg brain. When Dr. McCoy used the device in 2268, he experienced great pain. Spock initially warned him against using the device, concerned about the possibility of brain damage, but McCoy felt he had no choice as there was no other chance of restoring Spock's brain to his body before the body failed. McCoy hoped to retain the knowledge and share it with the galaxy, but could not do so. Reuse of the Teacher would likely have caused brain damage and kill the user. (TOS: "Spock's Brain")

The novelization of the episode explains that the reason why the landing team did not simply cycle each member through the Great Teacher in order to have enough time to finish Spock's operation was because McCoy's existing medical knowledge was augmented by the Great Teacher and that someone who was not a doctor to begin with would not have necessarily gained the medical knowledge to perform the operation on Spock.