Sokil\Mongo\DocumentGeoTest::testExpressionWithin PHP Method

testExpressionWithin() public method

    public function testExpressionWithin()
    {
        $this->collection->ensure2dSphereIndex('point');
        $point1Id = $this->collection->createDocument()->setPoint('point', 30.5326905, 50.4020355)->save()->getId();
        $point2Id = $this->collection->createDocument()->setPoint('point', 28.4696339, 49.234734)->save()->getId();
        $point = $this->collection->find()->within('point', new \GeoJson\Geometry\Polygon(array(array(array(24.0122356, 49.8326891), array(24.717129, 48.9117731), array(34.1092134, 44.946798), array(34.5572385, 49.6020445), array(24.0122356, 49.8326891)))))->findOne();
        $this->assertNotEmpty($point);
        $this->assertEquals($point2Id, $point->getId());
    }