 MongoDB Inc. shares soared in the extended session Tuesday after the database company surprised Wall Street with a profitable quarter while forecasting another one, while analysts had expected losses. 