Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
df6df1c5
Commit
df6df1c5
authored
Apr 23, 2018
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #533
parents
5e1ce36b
37168ad8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
1 deletion
+40
-1
apiargs-MongoDBDatabase-method-createCollection-option.yaml
...iargs-MongoDBDatabase-method-createCollection-option.yaml
+4
-1
CreateCollection.php
src/Operation/CreateCollection.php
+8
-0
CreateCollectionTest.php
tests/Operation/CreateCollectionTest.php
+11
-0
TestCase.php
tests/TestCase.php
+17
-0
No files found.
docs/includes/apiargs-MongoDBDatabase-method-createCollection-option.yaml
View file @
df6df1c5
...
@@ -9,7 +9,10 @@ description: |
...
@@ -9,7 +9,10 @@ description: |
For replica sets, do not set ``autoIndexId`` to ``false``.
For replica sets, do not set ``autoIndexId`` to ``false``.
.. deprecated:: 3.2. The ``autoIndexId`` option will be removed in MongoDB 3.4.
.. deprecated:: 1.4
This option has been deprecated since MongoDB 3.2. As of MongoDB 4.0, this
option cannot be ``false`` when creating a replicated collection (i.e. a
collection outside of the ``local`` database in any mongod mode).
interface
:
phpmethod
interface
:
phpmethod
operation
:
~
operation
:
~
optional
:
true
optional
:
true
...
...
src/Operation/CreateCollection.php
View file @
df6df1c5
...
@@ -53,6 +53,10 @@ class CreateCollection implements Executable
...
@@ -53,6 +53,10 @@ class CreateCollection implements Executable
* of an index on the _id field. For replica sets, this option cannot be
* of an index on the _id field. For replica sets, this option cannot be
* false. The default is true.
* false. The default is true.
*
*
* This option has been deprecated since MongoDB 3.2. As of MongoDB 4.0,
* this option cannot be false when creating a replicated collection
* (i.e. a collection outside of the local database in any mongod mode).
*
* * capped (boolean): Specify true to create a capped collection. If set,
* * capped (boolean): Specify true to create a capped collection. If set,
* the size option must also be specified. The default is false.
* the size option must also be specified. The default is false.
*
*
...
@@ -170,6 +174,10 @@ class CreateCollection implements Executable
...
@@ -170,6 +174,10 @@ class CreateCollection implements Executable
unset
(
$options
[
'writeConcern'
]);
unset
(
$options
[
'writeConcern'
]);
}
}
if
(
isset
(
$options
[
'autoIndexId'
]))
{
trigger_error
(
'The "autoIndexId" option is deprecated and will be removed in a future release'
,
E_USER_DEPRECATED
);
}
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
collectionName
=
(
string
)
$collectionName
;
$this
->
collectionName
=
(
string
)
$collectionName
;
$this
->
options
=
$options
;
$this
->
options
=
$options
;
...
...
tests/Operation/CreateCollectionTest.php
View file @
df6df1c5
...
@@ -82,4 +82,15 @@ class CreateCollectionTest extends TestCase
...
@@ -82,4 +82,15 @@ class CreateCollectionTest extends TestCase
return
$options
;
return
$options
;
}
}
public
function
testAutoIndexIdOptionIsDeprecated
()
{
$this
->
assertDeprecated
(
function
()
{
new
CreateCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
'autoIndexId'
=>
true
]);
});
$this
->
assertDeprecated
(
function
()
{
new
CreateCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
'autoIndexId'
=>
false
]);
});
}
}
}
tests/TestCase.php
View file @
df6df1c5
...
@@ -52,6 +52,23 @@ abstract class TestCase extends BaseTestCase
...
@@ -52,6 +52,23 @@ abstract class TestCase extends BaseTestCase
return
$this
->
wrapValuesForDataProvider
(
$this
->
getInvalidDocumentValues
());
return
$this
->
wrapValuesForDataProvider
(
$this
->
getInvalidDocumentValues
());
}
}
protected
function
assertDeprecated
(
callable
$execution
)
{
$errors
=
[];
set_error_handler
(
function
(
$errno
,
$errstr
)
use
(
&
$errors
)
{
$errors
[]
=
$errstr
;
},
E_USER_DEPRECATED
);
try
{
call_user_func
(
$execution
);
}
finally
{
restore_error_handler
();
}
$this
->
assertCount
(
1
,
$errors
);
}
protected
function
assertSameDocument
(
$expectedDocument
,
$actualDocument
)
protected
function
assertSameDocument
(
$expectedDocument
,
$actualDocument
)
{
{
$this
->
assertEquals
(
$this
->
assertEquals
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment