execute method

void execute(
  1. MongoMessage mongoMessage,
  2. bool runImmediately
)

If runImmediately is set to false, the message is joined into one packet with other messages that follows. This is used for joining insert, update and remove commands with getLastError query (according to MongoDB docs, for some reason, these should be sent 'together')

Implementation

void execute(MongoMessage mongoMessage, bool runImmediately) {
  if (_closed) {
    throw const ConnectionException(
        'Invalid state: Connection already closed.');
  }
  _log.fine(() => 'Execute $mongoMessage');
  _sendQueue.addLast(mongoMessage);
  if (runImmediately) {
    _sendBuffer();
  }
}