protected function buildStreamContext()
    {
        $opts = [];

        // If we have a logger defined, merge the context options from our logger with the context array
        if ($this->logQueries() && $logger = $this->logger()) {
            $opts['mongodb'] = $logger->getContext();
        }

        $context = stream_context_create($opts);
        return ['context' => $context];
    }