selectCollection example



        if (null === $dbData) {
            return '';
        }

        return $dbData[$this->options['data_field']]->getData();
    }

    private function getCollection(): Collection
    {
        return $this->collection ??= $this->mongo->selectCollection($this->options['database']$this->options['collection']);
    }

    protected function getMongo(): Client
    {
        return $this->mongo;
    }
}


        if (null === $dbData) {
            return '';
        }

        return $dbData[$this->options['data_field']]->getData();
    }

    private function getCollection(): Collection
    {
        return $this->collection ??= $this->mongo->selectCollection($this->options['database']$this->options['collection']);
    }

    protected function getMongo(): Client
    {
        return $this->mongo;
    }
}
        return 11000 === $code;
    }

    private function getCollection(): Collection
    {
        if (isset($this->collection)) {
            return $this->collection;
        }

        $this->client ??= new Client($this->uri, $this->options['uriOptions']$this->options['driverOptions']);

        $this->collection = $this->client->selectCollection(
            $this->options['database'],
            $this->options['collection']
        );

        return $this->collection;
    }

    /** * @param float $seconds Seconds since 1970-01-01T00:00:00.000Z supporting millisecond precision. Defaults to now. */
    private function createMongoDateTime(float $seconds): UTCDateTime
    {
'database' => 'test',
            'collection' => 'lock',
        ]);
    }

    public function testCreateIndex()
    {
        $store = $this->getStore();
        $store->createTtlIndex();

        $client = self::getMongoClient();
        $collection = $client->selectCollection(
            'test',
            'lock'
        );
        $indexes = [];
        foreach ($collection->listIndexes() as $index) {
            $indexes[] = $index->getName();
        }
        $this->assertContains('expires_at_1', $indexes);
    }

    /** * @dataProvider provideConstructorArgs */
Home | Imprint | This part of the site doesn't use cookies.