driver-legacy/src/main/com/mongodb/DBCursor.java
@SuppressWarnings("deprecation")
    @Deprecated
    public DBCursor addSpecial(@Nullable final String name, @Nullable final Object value) {
        if (name == null || value == null) {
            return this;
        }

        if ("$comment".equals(name)) {
            comment(value.toString());
        } else if ("$explain".equals(name)) {
            findOptions.getModifiers().put("$explain", true);
        } else if ("$hint".equals(name)) {
            if (value instanceof String) {
                hint((String) value);
            } else {
                hint((DBObject) value);
            }
        } else if ("$maxScan".equals(name)) {
            maxScan(((Number) value).intValue());
        } else if ("$maxTimeMS".equals(name)) {
            maxTime(((Number) value).longValue(), MILLISECONDS);
        } else if ("$max".equals(name)) {
            max((DBObject) value);
        } else if ("$min".equals(name)) {
            min((DBObject) value);
        } else if ("$orderby".equals(name)) {
            sort((DBObject) value);
        } else if ("$returnKey".equals(name)) {
            returnKey();
        } else if ("$showDiskLoc".equals(name)) {
            showDiskLoc();
        } else if ("$snapshot".equals(name)) {
            snapshot();
        } else if ("$natural".equals(name)) {
            sort(new BasicDBObject("$natural", ((Number) value).intValue()));
        } else {
            throw new IllegalArgumentException(name + "is not a supported modifier");
        }
        return this;
    }
@SuppressWarnings("deprecation")
    @Deprecated
    public DBCursor addSpecial(@Nullable final String name, @Nullable final Object value) {
        if (name == null || value == null) {
            return this;
        }

        if ("$comment".equals(name)) {
            comment(value.toString());
        } else if ("$explain".equals(name)) {
            findOptions.getModifiers().put("$explain", true);
        } else if ("$hint".equals(name)) {
            if (value instanceof String) {
                hint((String) value);
            } else {
                hint((DBObject) value);
            }
        } else if ("$maxScan".equals(name)) {
            maxScan(((Number) value).intValue());
        } else if ("$maxTimeMS".equals(name)) {
            maxTime(((Number) value).longValue(), MILLISECONDS);
        } else if ("$max".equals(name)) {
            max((DBObject) value);
        } else if ("$min".equals(name)) {
            min((DBObject) value);
        } else if ("$orderby".equals(name)) {
            sort((DBObject) value);
        } else if ("$returnKey".equals(name)) {
            returnKey();
        } else if ("$showDiskLoc".equals(name)) {
            showDiskLoc();
        } else if ("$snapshot".equals(name)) {
            snapshot();
        } else if ("$natural".equals(name)) {
            sort(new BasicDBObject("$natural", ((Number) value).intValue()));
        } else {
            throw new IllegalArgumentException(name + "is not a supported modifier");
        }
        return this;
    }
@ SuppressWarnings ( "deprecation" ) @ Deprecated public DBCursor addSpecial ( @ Nullable final String name , @ Nullable final Object value ) { if ( name == null || value == null ) { return this ; } if ( "$comment" . equals ( name ) ) { comment ( value . toString ( ) ) ; } else if ( "$explain" . equals ( name ) ) { findOptions . getModifiers ( ) . put ( "$explain" , true ) ; } else if ( "$hint" . equals ( name ) ) { if ( value instanceof String ) { hint ( ( String ) value ) ; } else { hint ( ( DBObject ) value ) ; } } else if ( "$maxScan" . equals ( name ) ) { maxScan ( ( ( Number ) value ) . intValue ( ) ) ; } else if ( "$maxTimeMS" . equals ( name ) ) { maxTime ( ( ( Number ) value ) . longValue ( ) , MILLISECONDS ) ; } else if ( "$max" . equals ( name ) ) { max ( ( DBObject ) value ) ; } else if ( "$min" . equals ( name ) ) { min ( ( DBObject ) value ) ; } else if ( "$orderby" . equals ( name ) ) { sort ( ( DBObject ) value ) ; } else if ( "$returnKey" . equals ( name ) ) { returnKey ( ) ; } else if ( "$showDiskLoc" . equals ( name ) ) { showDiskLoc ( ) ; } else if ( "$snapshot" . equals ( name ) ) { snapshot ( ) ; } else if ( "$natural" . equals ( name ) ) { sort ( new BasicDBObject ( "$natural" , ( ( Number ) value ) . intValue ( ) ) ) ; } else { throw new IllegalArgumentException ( name + "is not a supported modifier" ) ; } return this ; }
Adds a special operator like $comment or $returnKey. For example:
<pre>
addSpecial("$returnKey", 1)
addSpecial("$comment", "this is a special query)
</pre>

@param name  the name of the special query operator
@param value the value of the special query operator
@return {@code this} so calls can be chained
@mongodb.driver.manual reference/operator Special Operators
@deprecated Prefer per-operator methods, e.g. {@link #comment(String)}, {@link #explain()}, etc.
Adds a special operator like $comment or $returnKey . For example : <pre > addSpecial ( $returnKey 1 ) addSpecial ( $comment this is a special query ) < / pre >