public function findAndModify($collectionName, $condition = [], $update = [], $options = [])
    {
        $document = array_merge(['findAndModify' => $collectionName], $options);

        if (!empty($condition)) {
            $options['query'] = $this->buildCondition($condition);
        }

        if (!empty($update)) {
            $options['update'] = $update;
        }

        if (isset($options['fields'])) {
            $options['fields'] = $this->buildSelectFields($options['fields']);
        }

        if (isset($options['sort'])) {
            $options['sort'] = $this->buildSortFields($options['sort']);
        }

        foreach (['fields', 'query', 'sort', 'update'] as $name) {
            if (isset($options[$name])) {
                $document[$name] = (object) $options[$name];
            }
        }

        return $document;
    }