From ce10298791b83211749f8b96f8fa98e089bc5295 Mon Sep 17 00:00:00 2001 From: Katherine Walker Date: Wed, 4 Apr 2018 10:16:48 -0400 Subject: [PATCH] PHPLIB-278: Add examples for calling methods on database, collection, and index models --- ...ongoDBModelCollectionInfo-getCappedMax.txt | 22 ++++++++++++++++ ...ngoDBModelCollectionInfo-getCappedSize.txt | 21 +++++++++++++++ .../MongoDBModelCollectionInfo-getName.txt | 15 +++++++++++ .../MongoDBModelCollectionInfo-getOptions.txt | 26 +++++++++++++++++++ .../MongoDBModelCollectionInfo-isCapped.txt | 21 +++++++++++++++ .../MongoDBModelDatabaseInfo-getName.txt | 15 +++++++++++ ...MongoDBModelDatabaseInfo-getSizeOnDisk.txt | 15 +++++++++++ .../MongoDBModelDatabaseInfo-isEmpty.txt | 15 +++++++++++ .../method/MongoDBModelIndexInfo-getKey.txt | 20 ++++++++++++++ .../method/MongoDBModelIndexInfo-getName.txt | 17 ++++++++++++ .../MongoDBModelIndexInfo-getNamespace.txt | 17 ++++++++++++ .../MongoDBModelIndexInfo-getVersion.txt | 17 ++++++++++++ .../method/MongoDBModelIndexInfo-isSparse.txt | 17 ++++++++++++ .../method/MongoDBModelIndexInfo-isTtl.txt | 17 ++++++++++++ .../method/MongoDBModelIndexInfo-isUnique.txt | 17 ++++++++++++ 15 files changed, 272 insertions(+) diff --git a/docs/reference/method/MongoDBModelCollectionInfo-getCappedMax.txt b/docs/reference/method/MongoDBModelCollectionInfo-getCappedMax.txt index 693350f03..fb86ee19a 100644 --- a/docs/reference/method/MongoDBModelCollectionInfo-getCappedMax.txt +++ b/docs/reference/method/MongoDBModelCollectionInfo-getCappedMax.txt @@ -28,6 +28,28 @@ Return Values The document limit for the capped collection. If the collection is not capped, ``null`` will be returned. +Examples +-------- + +.. code-block:: php + + 'foo', + 'options' => [ + 'capped' => true, + 'size' => 1048576, + 'max' => 100, + ] + ]); + + var_dump($info->getCappedMax()); + +The output would then resemble:: + + int(100) + See Also -------- diff --git a/docs/reference/method/MongoDBModelCollectionInfo-getCappedSize.txt b/docs/reference/method/MongoDBModelCollectionInfo-getCappedSize.txt index cc0bd7694..a3b1ce48f 100644 --- a/docs/reference/method/MongoDBModelCollectionInfo-getCappedSize.txt +++ b/docs/reference/method/MongoDBModelCollectionInfo-getCappedSize.txt @@ -29,6 +29,27 @@ Return Values The size limit for the capped collection in bytes. If the collection is not capped, ``null`` will be returned. +Examples +-------- + +.. code-block:: php + + 'foo', + 'options' => [ + 'capped' => true, + 'size' => 1048576, + ] + ]); + + var_dump($info->getCappedSize()); + +The output would then resemble:: + + int(1048576) + See Also -------- diff --git a/docs/reference/method/MongoDBModelCollectionInfo-getName.txt b/docs/reference/method/MongoDBModelCollectionInfo-getName.txt index cd04ffaca..42226c203 100644 --- a/docs/reference/method/MongoDBModelCollectionInfo-getName.txt +++ b/docs/reference/method/MongoDBModelCollectionInfo-getName.txt @@ -26,6 +26,21 @@ Return Values The collection name. +Examples +-------- + +.. code-block:: php + + 'foo']); + + echo $info->getName(); + +The output would then resemble:: + + foo + See Also -------- diff --git a/docs/reference/method/MongoDBModelCollectionInfo-getOptions.txt b/docs/reference/method/MongoDBModelCollectionInfo-getOptions.txt index e360522ba..845068163 100644 --- a/docs/reference/method/MongoDBModelCollectionInfo-getOptions.txt +++ b/docs/reference/method/MongoDBModelCollectionInfo-getOptions.txt @@ -28,6 +28,32 @@ Return Values The collection options. +Examples +-------- + +.. code-block:: php + + 'foo', + 'options' => [ + 'capped' => true, + 'size' => 1048576, + ] + ]); + + var_dump($info->getOptions()); + +The output would then resemble:: + + array(2) { + ["capped"]=> + bool(true) + ["size"]=> + int(1048576) + } + See Also -------- diff --git a/docs/reference/method/MongoDBModelCollectionInfo-isCapped.txt b/docs/reference/method/MongoDBModelCollectionInfo-isCapped.txt index abfc387d8..a583a83fc 100644 --- a/docs/reference/method/MongoDBModelCollectionInfo-isCapped.txt +++ b/docs/reference/method/MongoDBModelCollectionInfo-isCapped.txt @@ -27,6 +27,27 @@ Return Values A boolean indicating whether the collection is a capped collection. +Examples +-------- + +.. code-block:: php + + 'foo', + 'options' => [ + 'capped' => true, + 'size' => 1048576, + ] + ]); + + var_dump($info->isCapped()); + +The output would then resemble:: + + bool(true) + See Also -------- diff --git a/docs/reference/method/MongoDBModelDatabaseInfo-getName.txt b/docs/reference/method/MongoDBModelDatabaseInfo-getName.txt index 47991f1af..a2524a4b1 100644 --- a/docs/reference/method/MongoDBModelDatabaseInfo-getName.txt +++ b/docs/reference/method/MongoDBModelDatabaseInfo-getName.txt @@ -26,6 +26,21 @@ Return Values The database name. +Examples +-------- + +.. code-block:: php + + 'foo']); + + echo $info->getName(); + +The output would then resemble:: + + foo + See Also -------- diff --git a/docs/reference/method/MongoDBModelDatabaseInfo-getSizeOnDisk.txt b/docs/reference/method/MongoDBModelDatabaseInfo-getSizeOnDisk.txt index 2a8fe5ad7..d42f23ff5 100644 --- a/docs/reference/method/MongoDBModelDatabaseInfo-getSizeOnDisk.txt +++ b/docs/reference/method/MongoDBModelDatabaseInfo-getSizeOnDisk.txt @@ -26,6 +26,21 @@ Return Values The total size of the database file on disk in bytes. +Examples +-------- + +.. code-block:: php + + 1048576]); + + var_dump($info->getSizeOnDisk()); + +The output would then resemble:: + + int(1048576) + See Also -------- diff --git a/docs/reference/method/MongoDBModelDatabaseInfo-isEmpty.txt b/docs/reference/method/MongoDBModelDatabaseInfo-isEmpty.txt index 878844d05..ae25e67f2 100644 --- a/docs/reference/method/MongoDBModelDatabaseInfo-isEmpty.txt +++ b/docs/reference/method/MongoDBModelDatabaseInfo-isEmpty.txt @@ -26,6 +26,21 @@ Return Values A boolean indicating whether the database has any data. +Examples +-------- + +.. code-block:: php + + true]); + + var_dump($info->isEmpty()); + +The output would then resemble:: + + bool(true) + See Also -------- diff --git a/docs/reference/method/MongoDBModelIndexInfo-getKey.txt b/docs/reference/method/MongoDBModelIndexInfo-getKey.txt index 6ad0712e6..1a115f9cc 100644 --- a/docs/reference/method/MongoDBModelIndexInfo-getKey.txt +++ b/docs/reference/method/MongoDBModelIndexInfo-getKey.txt @@ -28,6 +28,26 @@ Return Values The index specification as an associative array. +Examples +-------- + +.. code-block:: php + + ['x' => 1], + ]); + + var_dump($info->getKey()); + +The output would then resemble:: + + array(1) { + ["x"]=> + int(1) + } + See Also -------- diff --git a/docs/reference/method/MongoDBModelIndexInfo-getName.txt b/docs/reference/method/MongoDBModelIndexInfo-getName.txt index 26983790e..97ad45fae 100644 --- a/docs/reference/method/MongoDBModelIndexInfo-getName.txt +++ b/docs/reference/method/MongoDBModelIndexInfo-getName.txt @@ -29,6 +29,23 @@ Return Values The index name. +Examples +-------- + +.. code-block:: php + + 'x_1', + ]); + + echo $info->getName(); + +The output would then resemble:: + + x_1 + See Also -------- diff --git a/docs/reference/method/MongoDBModelIndexInfo-getNamespace.txt b/docs/reference/method/MongoDBModelIndexInfo-getNamespace.txt index 987c8becc..f4a64bb66 100644 --- a/docs/reference/method/MongoDBModelIndexInfo-getNamespace.txt +++ b/docs/reference/method/MongoDBModelIndexInfo-getNamespace.txt @@ -27,6 +27,23 @@ Return Values The index namespace. +Examples +-------- + +.. code-block:: php + + 'foo.bar', + ]); + + echo $info->getNamespace(); + +The output would then resemble:: + + foo.bar + See Also -------- diff --git a/docs/reference/method/MongoDBModelIndexInfo-getVersion.txt b/docs/reference/method/MongoDBModelIndexInfo-getVersion.txt index e2480df05..728f38858 100644 --- a/docs/reference/method/MongoDBModelIndexInfo-getVersion.txt +++ b/docs/reference/method/MongoDBModelIndexInfo-getVersion.txt @@ -26,6 +26,23 @@ Return Values The index version. +Examples +-------- + +.. code-block:: php + + 1, + ]); + + var_dump($info->getVersion()); + +The output would then resemble:: + + int(1) + See Also -------- diff --git a/docs/reference/method/MongoDBModelIndexInfo-isSparse.txt b/docs/reference/method/MongoDBModelIndexInfo-isSparse.txt index 580e2f603..5bbe4dea4 100644 --- a/docs/reference/method/MongoDBModelIndexInfo-isSparse.txt +++ b/docs/reference/method/MongoDBModelIndexInfo-isSparse.txt @@ -28,6 +28,23 @@ Return Values A boolean indicating whether the index is a sparse index. +Examples +-------- + +.. code-block:: php + + true, + ]); + + var_dump($info->isSparse()); + +The output would then resemble:: + + bool(true) + See Also -------- diff --git a/docs/reference/method/MongoDBModelIndexInfo-isTtl.txt b/docs/reference/method/MongoDBModelIndexInfo-isTtl.txt index f2f16e024..a3e70d036 100644 --- a/docs/reference/method/MongoDBModelIndexInfo-isTtl.txt +++ b/docs/reference/method/MongoDBModelIndexInfo-isTtl.txt @@ -28,6 +28,23 @@ Return Values A boolean indicating whether the index is a TTL index. +Examples +-------- + +.. code-block:: php + + 100, + ]); + + var_dump($info->isTtl()); + +The output would then resemble:: + + bool(true) + See Also -------- diff --git a/docs/reference/method/MongoDBModelIndexInfo-isUnique.txt b/docs/reference/method/MongoDBModelIndexInfo-isUnique.txt index 5fbfa7657..30cf1ece5 100644 --- a/docs/reference/method/MongoDBModelIndexInfo-isUnique.txt +++ b/docs/reference/method/MongoDBModelIndexInfo-isUnique.txt @@ -28,6 +28,23 @@ Return Values A boolean indicating whether the index is a unique index. +Examples +-------- + +.. code-block:: php + + true, + ]); + + var_dump($info->isUnique()); + +The output would then resemble:: + + bool(true) + See Also --------