Ah, look, I have already responded to this :-)

The technique is to use echo inside the function and x=$(mongoCmd xxx) to catch the 'echoed return value'.
"Real" return values can only be done with integers unfortunately.