Skip to content

Commit bad8d89

Browse files
committed
DOCSP-50772: isView()
1 parent be5f26f commit bad8d89

File tree

4 files changed

+103
-37
lines changed

4 files changed

+103
-37
lines changed

source/read/change-streams.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ allows your application to subscribe to data changes on a collection, database,
2626
or deployment.
2727

2828
When using the {+php-library+}, you can call the ``watch()`` method to return an
29-
instance of ``MongoDB\ChangeStream``. Then, you can iterate through the
29+
instance of ``MongoDB\ChangeStream``. Then, you can iterate through the
3030
``MongoDB\ChangeStream`` instance to monitor data changes, such as updates,
3131
insertions, and deletions.
3232

@@ -38,18 +38,18 @@ database from the :atlas:`Atlas sample datasets </sample-data>`. To access this
3838
from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster
3939
and assign the following value to your ``$collection`` variable:
4040

41-
.. literalinclude:: /includes/read/change/streams/change-stream.php
41+
.. literalinclude:: /includes/read/change-streams/change-stream.php
4242
:language: php
4343
:dedent:
4444
:start-after: start-db-coll
4545
:end-before: end-db-coll
4646

47-
.. tip::
47+
.. tip::
4848

4949
To learn how to create a free MongoDB Atlas cluster and load the sample datasets, see the
5050
:atlas:`Get Started with Atlas </getting-started>` guide.
5151

52-
Some examples use the ``toJSON()`` function to represent change events, which are BSON
52+
Some examples use the ``toJSON()`` function to represent change events, which are BSON
5353
documents, as Extended JSON. To use this function, paste the following code into your
5454
application file:
5555

@@ -100,7 +100,7 @@ as it occurs. The printed change event resembles the following output:
100100

101101
{ "_id" : { "_data" : "..." }, "operationType" : "update", "clusterTime" :
102102
{ "$timestamp" : { ... } }, "wallTime" : { "$date" : "..." }, "ns" : { "db" :
103-
"sample_restaurants", "coll" : "restaurants" }, "documentKey" : { "_id" :
103+
"sample_restaurants", "coll" : "restaurants" }, "documentKey" : { "_id" :
104104
{ "$oid" : "..." } }, "updateDescription" : { "updatedFields" : { "cuisine" : "Irish" },
105105
"removedFields" : [ ], "truncatedArrays" : [ ] } }
106106

@@ -170,7 +170,7 @@ can set in the array:
170170

171171
* - ``startAtOperationTime``
172172
- | Instructs the change stream to only provide changes that occurred at or after
173-
the specified timestamp.
173+
the specified timestamp.
174174
| This option is mutually exclusive with ``startAfter`` and ``resumeAfter``.
175175

176176
* - ``collation``
@@ -205,7 +205,7 @@ to one of the following values:
205205
change event field has a ``null`` value.
206206
- ``MongoDB\Operation\Watch::FULL_DOCUMENT_BEFORE_CHANGE_REQUIRED``: The change event includes a pre-image
207207
of the modified document for change events. If the pre-image is not available, the
208-
server raises an error.
208+
server raises an error.
209209

210210
The **post-image** is the full version of a document *after* a change. To include the
211211
post-image in the change stream event, set the ``fullDocument`` option to
@@ -240,7 +240,7 @@ output:
240240

241241
{ "_id" : { "_data" : "..." }, "operationType" : "update", "clusterTime" :
242242
{ "$timestamp" : { ... } }, "wallTime" : { "$date" : "..." },
243-
"fullDocument" : { "_id" : { "$oid" : "..." }, "address" : { "building" :
243+
"fullDocument" : { "_id" : { "$oid" : "..." }, "address" : { "building" :
244244
"202-24", "coord" : [ -73.925044200000002093, 40.559546199999999772 ], "street"
245245
: "Rockaway Point Boulevard", "zipcode" : "11697" }, "borough" : "Queens",
246246
"cuisine" : "Irish", "grades" : [ ...], "name" : "Blarney Castle", "restaurant_id" :
@@ -251,8 +251,8 @@ output:
251251

252252
.. tip::
253253

254-
To learn more about pre-images and post-images, see
255-
:manual:`Change Streams with Document Pre- and Post-Images </changeStreams#change-streams-with-document-pre--and-post-images>`
254+
To learn more about pre-images and post-images, see
255+
:manual:`Change Streams with Document Pre- and Post-Images </changeStreams#change-streams-with-document-pre--and-post-images>`
256256
in the {+mdb-server+} manual.
257257

258258
Additional Information

source/reference/class/MongoDBModelCollectionInfo.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Methods
3939
getOptions() </reference/method/MongoDBModelCollectionInfo-getOptions>
4040
getType() </reference/method/MongoDBModelCollectionInfo-getType>
4141
isCapped() </reference/method/MongoDBModelCollectionInfo-isCapped>
42+
isView() </reference/method/MongoDBModelCollectionInfo-isView>
4243

4344
- :phpmethod:`MongoDB\Model\CollectionInfo::getCappedMax()`
4445
- :phpmethod:`MongoDB\Model\CollectionInfo::getCappedSize()`
@@ -47,4 +48,5 @@ Methods
4748
- :phpmethod:`MongoDB\Model\CollectionInfo::getName()`
4849
- :phpmethod:`MongoDB\Model\CollectionInfo::getOptions()`
4950
- :phpmethod:`MongoDB\Model\CollectionInfo::getType()`
50-
- :phpmethod:`MongoDB\Model\CollectionInfo::isCapped()`
51+
- :phpmethod:`MongoDB\Model\CollectionInfo::isCapped()`
52+
- :phpmethod:`MongoDB\Model\CollectionInfo::isView()`
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
========================================
2+
MongoDB\\Model\\CollectionInfo::isView()
3+
========================================
4+
5+
.. contents:: On this page
6+
:local:
7+
:backlinks: none
8+
:depth: 1
9+
:class: singlecol
10+
11+
Definition
12+
----------
13+
14+
.. phpmethod:: MongoDB\Model\CollectionInfo::isView()
15+
16+
Return whether the collection is a :manual:`view </core/views/>`.
17+
18+
.. code-block:: php
19+
20+
function isView(): boolean
21+
22+
Return Values
23+
-------------
24+
25+
A boolean indicating whether the collection is a view.
26+
27+
Examples
28+
--------
29+
30+
.. code-block:: php
31+
32+
<?php
33+
34+
$info = new CollectionInfo([
35+
'name' => 'foo',
36+
'type' => 'view',
37+
'info' => ['readOnly' => true],
38+
]);
39+
40+
var_dump($info->isView());
41+
42+
The output would then resemble:
43+
44+
.. code-block:: none
45+
46+
bool(true)
47+
48+
See Also
49+
--------
50+
51+
- :manual:`Views </core/views/>` in the {+mdb-server+} manual
52+
- :manual:`Create and Query a View </views/create-view/>` in the {+mdb-server+} manual

source/whats-new.txt

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ What's New
2020
Learn about new features, improvements, and fixes introduced in the
2121
following versions of the {+php-library+}:
2222

23+
* :ref:`Version 2.2 <php-lib-version-2.2>`
2324
* :ref:`Version 2.1 <php-lib-version-2.1>`
2425
* :ref:`Version 2.0 <php-lib-version-2.0>`
2526
* :ref:`Version 1.21 <php-lib-version-1.21>`
@@ -28,6 +29,17 @@ following versions of the {+php-library+}:
2829
* :ref:`Version 1.18 <php-lib-version-1.18>`
2930
* :ref:`Version 1.17 <php-lib-version-1.17>`
3031

32+
.. _php-lib-version-2.2:
33+
34+
What's New in 2.2
35+
-----------------
36+
37+
The {+library-short+} v2.2 release includes the following features,
38+
improvements, and fixes:
39+
40+
- Adds the :phpmethod:`MongoDB\Model\CollectionInfo::isView()` method to
41+
determine whether a collection is a :manual:`view </core/views/>`.
42+
3143
.. _php-lib-version-2.1:
3244

3345
What's New in 2.1
@@ -61,13 +73,13 @@ What's New in 2.0
6173

6274
- The following methods return ``void`` instead of the raw command
6375
response:
64-
76+
6577
- ``MongoDB\Client``: ``dropDatabase()``
6678
- ``MongoDB\Collection``: ``drop()``, ``dropIndex()``,
6779
``dropIndexes()``, ``dropSearchIndex()``, ``rename()``
6880
- ``MongoDB\Database``: ``createCollection()``, ``drop()``,
6981
``dropCollection()``, ``renameCollection()``
70-
82+
7183
To learn more about breaking changes in this release, see the
7284
:ref:`Version 2.0 Breaking Changes <php-v2-breaking-changes>` section
7385
in the Upgrade Library Versions guide.
@@ -80,7 +92,7 @@ and removals:
8092
- :phpmethod:`MongoDB\Client::getDatabase()`: alias for :phpmethod:`MongoDB\Client::selectDatabase()`
8193
- :phpmethod:`MongoDB\Client::getCollection()`: alias for :phpmethod:`MongoDB\Client::selectCollection()`
8294
- :phpmethod:`MongoDB\Database::getCollection()`: alias for :phpmethod:`MongoDB\Database::selectCollection()`
83-
95+
8496
The ``Client::selectCollection()``, ``Client::selectDatabase()``, and
8597
``Database::selectCollection()`` methods will be deprecated and
8698
replaced by these new methods in a future driver release, so consider
@@ -177,7 +189,7 @@ improvements, and fixes:
177189
more type-safe and organized way. To learn more, see the
178190
:ref:`php-atlas-search` and :ref:`php-vector-search` guides.
179191

180-
- Deprecates the ``flags`` option, used for the deprecated MMAPv1 storage engine.
192+
- Deprecates the ``flags`` option, used for the deprecated MMAPv1 storage engine.
181193
This option will be removed in {+library-short+} v2.0.
182194

183195
- Adds a sort option to the :phpmethod:`MongoDB\Collection::updateOne()`
@@ -189,7 +201,7 @@ improvements, and fixes:
189201

190202
- :phpmethod:`Database constructor <MongoDB\Database::__construct()>`
191203
- :phpmethod:`MongoDB\Database::withOptions()`
192-
- :phpmethod:`Collection constructor <MongoDB\Collection::__construct()>`
204+
- :phpmethod:`Collection constructor <MongoDB\Collection::__construct()>`
193205
- :phpmethod:`MongoDB\Collection::withOptions()`
194206

195207
For more information about the changes in this version, see the
@@ -246,48 +258,48 @@ and was added to keep version parity with the {+extension-short+}.
246258
What's New in 1.18
247259
------------------
248260

249-
- Adds a new GridFS API to make it more convenient to work with files using PHP's
250-
existing filesystem functions. The :phpmethod:`MongoDB\GridFS\Bucket::registerGlobalStreamWrapperAlias()`
251-
method may be used to register a global alias for a GridFS bucket. After
252-
doing so, files within that bucket can be accessed by using only a file URI
261+
- Adds a new GridFS API to make it more convenient to work with files using PHP's
262+
existing filesystem functions. The :phpmethod:`MongoDB\GridFS\Bucket::registerGlobalStreamWrapperAlias()`
263+
method may be used to register a global alias for a GridFS bucket. After
264+
doing so, files within that bucket can be accessed by using only a file URI
253265
(e.g. "gridfs://mybucket/hello.txt"). A demonstration of this API can be found
254-
in the `gridfs_stream_wrapper.php <https://github.com/mongodb/mongo-php-library/blob/1.18.0/examples/gridfs_stream_wrapper.php>`__
266+
in the `gridfs_stream_wrapper.php <https://github.com/mongodb/mongo-php-library/blob/1.18.0/examples/gridfs_stream_wrapper.php>`__
255267
example script.
256268

257-
- Adds :phpmethod:`MongoDB\Client::addSubscriber()` and
258-
:phpmethod:`MongoDB\Client::removeSubscriber()` methods to the
259-
``MongoDB\Client`` class to make it easier to register monitoring classes
269+
- Adds :phpmethod:`MongoDB\Client::addSubscriber()` and
270+
:phpmethod:`MongoDB\Client::removeSubscriber()` methods to the
271+
``MongoDB\Client`` class to make it easier to register monitoring classes
260272
scoped to the underlying ``MongoDB\Driver\Manager`` object.
261273

262-
To learn more about this release, see the `v1.18 Release Notes
274+
To learn more about this release, see the `v1.18 Release Notes
263275
<https://github.com/mongodb/mongo-php-library/releases/tag/1.18.0>`__ on GitHub.
264276

265277
.. _php-lib-version-1.17:
266278

267279
What's New in 1.17
268280
------------------
269281

270-
- Introduces a new "codec" API for converting BSON to and from PHP objects.
271-
More information on this feature may be found in the
282+
- Introduces a new "codec" API for converting BSON to and from PHP objects.
283+
More information on this feature may be found in the
272284
:ref:`Codecs tutorial <php-codecs>`.
273285

274-
- Adds :phpmethod:`MongoDB\add_logger()` and
275-
:phpmethod:`MongoDB\remove_logger()` functions to the library.
286+
- Adds :phpmethod:`MongoDB\add_logger()` and
287+
:phpmethod:`MongoDB\remove_logger()` functions to the library.
276288
These functions allow applications to register a `PSR-3 Logger <https://www.php-fig.org/psr/psr-3/>`__
277-
to receive log messages emitted by the driver. Previously, logs were only
278-
available through the extension's `mongodb.debug <https://www.php.net/manual/en/mongodb.configuration.php#ini.mongodb.debug>`__
289+
to receive log messages emitted by the driver. Previously, logs were only
290+
available through the extension's `mongodb.debug <https://www.php.net/manual/en/mongodb.configuration.php#ini.mongodb.debug>`__
279291
``INI`` setting.
280292

281-
- Introduces new :phpclass:`MongoDB\Collection` methods to create and manage
282-
Atlas Search indexes. Atlas Search indexes can be queried using the ``$search``
293+
- Introduces new :phpclass:`MongoDB\Collection` methods to create and manage
294+
Atlas Search indexes. Atlas Search indexes can be queried using the ``$search``
283295
aggregation pipeline stage, which is supported in all versions of the library.
284-
To learn more about Atlas Search indexes and the specifics of the ``$search``
285-
aggregation stage, see the :atlas:`Atlas Search indexes </atlas-search>`
296+
To learn more about Atlas Search indexes and the specifics of the ``$search``
297+
aggregation stage, see the :atlas:`Atlas Search indexes </atlas-search>`
286298
documentation and :manual:`$search </reference/operator/aggregation/search/>`.
287299

288-
- Upgrades the ``mongodb`` extension requirement to 1.17.0. Support for PHP
300+
- Upgrades the ``mongodb`` extension requirement to 1.17.0. Support for PHP
289301
7.2 and 7.3 has been removed and the library now requires PHP 7.4 or newer.
290302

291-
To learn more about this release, see the `v1.17 Release Notes
303+
To learn more about this release, see the `v1.17 Release Notes
292304
<https://github.com/mongodb/mongo-php-library/releases/tag/1.17.0>`__ on
293305
GitHub.

0 commit comments

Comments
 (0)