Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

杨树贤 / ucenter

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Find file
Normal viewHistoryPermalink
Switch branch/tag
  • ucenter
  • ..
  • method
  • MongoDBCollection__construct.txt
MongoDBCollection__construct.txt 1.46 KB
杨树贤's avatar
初始化项目
130b5f67
 
杨树贤 committed a year ago
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
==================================
MongoDB\\Collection::__construct()
==================================

.. default-domain:: mongodb

.. contents:: On this page
   :local:
   :backlinks: none
   :depth: 1
   :class: singlecol

Definition
----------

.. phpmethod:: MongoDB\\Collection::__construct()

   Constructs a new :phpclass:`Collection <MongoDB\\Collection>` instance.

   .. code-block:: php

      function __construct(MongoDB\Driver\Manager $manager, $databaseName, $collectionName, array $options = [])

   This constructor has the following parameters:

   .. include:: /includes/apiargs/MongoDBCollection-method-construct-param.rst

   The ``$options`` parameter supports the following options:

   .. include:: /includes/apiargs/MongoDBCollection-method-construct-option.rst

Errors/Exceptions
-----------------

.. include:: /includes/extracts/error-invalidargumentexception.rst

Behavior
--------

If you construct a Collection explicitly, the Collection inherits any options
from the :php:`MongoDB\\Driver\\Manager <class.mongodb-driver-manager>` object.
If you select the Collection from a :phpclass:`Client <MongoDB\\Client>` or
:phpclass:`Database <MongoDB\\Database>` object, the Collection inherits its
options from that object.

.. todo: add an example

See Also
--------

- :phpmethod:`MongoDB\\Collection::withOptions()`
- :phpmethod:`MongoDB\\Client::selectCollection()`
- :phpmethod:`MongoDB\\Database::selectCollection()`
- :phpmethod:`MongoDB\\Database::__get()`