src/Repository/DraftableEntityAwareTrait.php
public function createQueryBuilder($findDrafts = false)
    {
        /* @var \Doctrine\MongoDB\Query\Builder $qb */
        /** @noinspection PhpUndefinedClassInspection */
        /** @noinspection PhpUndefinedMethodInspection */
        $qb = parent::createQueryBuilder();

        if (null !== $findDrafts) {
            $qb->field('isDraft')->equals($findDrafts);
        }
        return $qb;
    }
public function createQueryBuilder($findDrafts = false)
    {
        /* @var \Doctrine\MongoDB\Query\Builder $qb */
        /** @noinspection PhpUndefinedClassInspection */
        /** @noinspection PhpUndefinedMethodInspection */
        $qb = parent::createQueryBuilder();

        if (null !== $findDrafts) {
            $qb->field('isDraft')->equals($findDrafts);
        }
        return $qb;
    }
Creates a query builder.

Prepopulate the constraint for 'isDraft' according to $findDrafts:
- true: queryBuilder will return only drafts
- false: queryBuilder will return only non drafts.
- null: queryBuilder will return all entities matching the additional constraints.

@param bool|null $findDrafts

@return \Doctrine\MongoDB\Query\Builder