lib/mongo/database/view.rb
# Get all the names of the non-system collections in the database.
#
# @note The set of returned collection names depends on the version of
#   MongoDB server that fulfills the request.
#
# @param [ Hash ] options Options for the listCollections command.
#
# @option options [ Integer ] :batch_size  The batch size for results
#   returned from the listCollections command.
# @option options [ Hash ] :filter A filter on the collections returned.
# @option options [ true, false ] :authorized_collections A flag, when
#   set to true, that allows a user without the required privilege
#   to run the command when access control is enforced
#
#   See https://docs.mongodb.com/manual/reference/command/listCollections/
#   for more information and usage.
#
# @return [ Array<String> ] The names of all non-system collections.
#
# @since 2.0.0
Get all the names of the non-system collections in the database.
Get all the names of the non - system collections in the database .
def collection_names(options = {})
        @batch_size = options[:batch_size]
        session = client.send(:get_session, options)
        cursor = read_with_retry_cursor(session, ServerSelector.primary, self) do |server|
          send_initial_query(server, session, options.merge(name_only: true))
        end
        cursor.map do |info|
          if cursor.initial_result.connection_description.features.list_collections_enabled?
            info['name']
          else
            (info['name'] &&
              info['name'].sub("#{@database.name}.", ''))
          end
        end.reject do |name|
          name.start_with?('system.') || name.include?('$')
        end
      end
def collection_names ( options = { } ) @batch_size = options [ :batch_size ] session = client . send ( :get_session , options ) cursor = read_with_retry_cursor ( session , ServerSelector . primary , self ) do | server | send_initial_query ( server , session , options . merge ( name_only : true ) ) end cursor . map do | info | if cursor . initial_result . connection_description . features . list_collections_enabled? info [ 'name' ] else ( info [ 'name' ] && info [ 'name' ] . sub ( "#{@database.name}." , '' ) ) end end . reject do | name | name . start_with? ( 'system.' ) || name . include? ( '$' ) end end
Get all the names of the non-system collections in the database.
Get all the names of the non - system collections in the database .
The names of all non-system collections.
The names of all non - system collections .
 Array<String> 
options
None
<not_specific>
options Options for the listCollections command.
options Options for the listCollections command .
note
The set of returned collection names depends on the version of MongoDB server that fulfills the request.
The set of returned collection names depends on the version of MongoDB server that fulfills the request .
since
None