def find_one_and_replace(filter, replacement, options = {})
      find(filter, options).find_one_and_update(replacement, options)
    end
def find_one_and_replace(filter, replacement, options = {})
      find(filter, options).find_one_and_update(replacement, options)
    end
Finds a single document and replaces it, returning the original doc unless
 otherwise specified.

 @example Find a document and replace it, returning the original.
   collection.find_one_and_replace({ name: 'test' }, { name: 'test1' })

 @example Find a document and replace it, returning the new document.
   collection.find_one_and_replace({ name: 'test' }, { name: 'test1' }, :return_document => :after)

 @param [ Hash ] filter The filter to use.
 @param [ BSON::Document ] replacement The replacement document.
 @param [ Hash ] options The options.

 @option options [ Integer ] :max_time_ms The maximum amount of time to allow the command
   to run in milliseconds.
 @option options [ Hash ] :projection The fields to include or exclude in the returned doc.
 @option options [ Hash ] :sort The key and direction pairs by which the result set
   will be sorted.
 @option options [ Symbol ] :return_document Either :before or :after.
 @option options [ true, false ] :upsert Whether to upsert if the document doesn't exist.
 @option options [ true, false ] :bypass_document_validation Whether or
   not to skip document level validation.
 @option options [ Hash ] :write_concern The write concern options.
   Defaults to the collection's write concern.
 @option options [ Hash ] :collation The collation to use.
 @option options [ Session ] :session The session to use.

 @return [ BSON::Document ] The document.

 @since 2.1.0