diff --git a/docs/includes/apiargs-MongoDBClient-method-dropDatabase-option.yaml b/docs/includes/apiargs-MongoDBClient-method-dropDatabase-option.yaml index 07e75df74..be0a19aa9 100644 --- a/docs/includes/apiargs-MongoDBClient-method-dropDatabase-option.yaml +++ b/docs/includes/apiargs-MongoDBClient-method-dropDatabase-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: session diff --git a/docs/includes/apiargs-MongoDBClient-method-listDatabases-option.yaml b/docs/includes/apiargs-MongoDBClient-method-listDatabases-option.yaml index fa544cce0..38baf93ad 100644 --- a/docs/includes/apiargs-MongoDBClient-method-listDatabases-option.yaml +++ b/docs/includes/apiargs-MongoDBClient-method-listDatabases-option.yaml @@ -13,6 +13,15 @@ interface: phpmethod operation: ~ optional: true --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- arg_name: option name: filter type: array|object diff --git a/docs/includes/apiargs-MongoDBClient-method-watch-option.yaml b/docs/includes/apiargs-MongoDBClient-method-watch-option.yaml index 7fa5400a8..96d11eacb 100644 --- a/docs/includes/apiargs-MongoDBClient-method-watch-option.yaml +++ b/docs/includes/apiargs-MongoDBClient-method-watch-option.yaml @@ -7,6 +7,15 @@ source: file: apiargs-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + The comment can be any valid BSON type for server versions 4.4 and above. + Earlier server versions only support string values. + + .. versionadded:: 1.13 +--- source: file: apiargs-method-watch-option.yaml ref: fullDocument diff --git a/docs/includes/apiargs-MongoDBCollection-method-aggregate-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-aggregate-option.yaml index a2fc460d9..b3d19c3e5 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-aggregate-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-aggregate-option.yaml @@ -11,9 +11,12 @@ source: ref: bypassDocumentValidation --- source: - file: apiargs-aggregate-option.yaml + file: apiargs-common-option.yaml ref: comment post: | + The comment can be any valid BSON type for server versions 4.4 and above. + Earlier server versions only support string values. + .. versionadded:: 1.3 --- source: diff --git a/docs/includes/apiargs-MongoDBCollection-method-bulkWrite-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-bulkWrite-option.yaml index 7949954d6..25d8e24d3 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-bulkWrite-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-bulkWrite-option.yaml @@ -2,6 +2,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: bypassDocumentValidation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: let diff --git a/docs/includes/apiargs-MongoDBCollection-method-count-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-count-option.yaml index 62227f1cc..3d839e04a 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-count-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-count-option.yaml @@ -2,6 +2,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- arg_name: option name: hint type: string|array|object diff --git a/docs/includes/apiargs-MongoDBCollection-method-countDocuments-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-countDocuments-option.yaml index 2571b0716..da1f01138 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-countDocuments-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-countDocuments-option.yaml @@ -2,6 +2,13 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + The comment can be any valid BSON type for server versions 4.4 and above. + Earlier server versions only support string values. +--- arg_name: option name: hint type: string|array|object diff --git a/docs/includes/apiargs-MongoDBCollection-method-createIndex-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-createIndex-option.yaml index 18d1ce07e..182837674 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-createIndex-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-createIndex-option.yaml @@ -17,6 +17,15 @@ interface: phpmethod operation: ~ optional: true --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- arg_name: option name: unique type: boolean diff --git a/docs/includes/apiargs-MongoDBCollection-method-createIndexes-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-createIndexes-option.yaml index 5728ab31b..54c33bfa0 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-createIndexes-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-createIndexes-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-MongoDBCollection-method-createIndex-option.yaml ref: commitQuorum diff --git a/docs/includes/apiargs-MongoDBCollection-method-deleteMany-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-deleteMany-option.yaml index b11e4f5f1..110911f51 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-deleteMany-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-deleteMany-option.yaml @@ -2,6 +2,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: hint diff --git a/docs/includes/apiargs-MongoDBCollection-method-deleteOne-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-deleteOne-option.yaml index b11e4f5f1..110911f51 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-deleteOne-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-deleteOne-option.yaml @@ -2,6 +2,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: hint diff --git a/docs/includes/apiargs-MongoDBCollection-method-distinct-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-distinct-option.yaml index 3c2ae6ed2..05a1b2853 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-distinct-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-distinct-option.yaml @@ -2,6 +2,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: maxTimeMS diff --git a/docs/includes/apiargs-MongoDBCollection-method-drop-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-drop-option.yaml index 7e08cf431..5eb5efaba 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-drop-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-drop-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-dropCollection-option.yaml ref: encryptedFields diff --git a/docs/includes/apiargs-MongoDBCollection-method-dropIndex-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-dropIndex-option.yaml index 9bc36f4bf..b87e09b74 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-dropIndex-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-dropIndex-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: maxTimeMS diff --git a/docs/includes/apiargs-MongoDBCollection-method-dropIndexes-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-dropIndexes-option.yaml index 0aa5048f2..aff9f4d75 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-dropIndexes-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-dropIndexes-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: maxTimeMS diff --git a/docs/includes/apiargs-MongoDBCollection-method-estimateDocumentCount-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-estimateDocumentCount-option.yaml index f70487a16..7289296e9 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-estimateDocumentCount-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-estimateDocumentCount-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: maxTimeMS diff --git a/docs/includes/apiargs-MongoDBCollection-method-explain-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-explain-option.yaml index 7c6a4dcd0..650633bce 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-explain-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-explain-option.yaml @@ -1,3 +1,14 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + Defaults to the ``comment`` of the explained operation (if any). + + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-MongoDBCollection-common-option.yaml ref: readPreference diff --git a/docs/includes/apiargs-MongoDBCollection-method-find-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-find-option.yaml index e80f2365f..1b01599ec 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-find-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-find-option.yaml @@ -74,15 +74,12 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- -arg_name: option -name: comment -type: string -description: | - A comment to attach to the query to help interpret and trace query - :dbcommand:`profile` data. -interface: phpmethod -operation: ~ -optional: true +source: + file: apiargs-common-option.yaml + ref: comment +post: | + The comment can be any valid BSON type for server versions 4.4 and above. + Earlier server versions only support string values. --- arg_name: option name: cursorType diff --git a/docs/includes/apiargs-MongoDBCollection-method-findOneAndDelete-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-findOneAndDelete-option.yaml index 062700579..d8f2b3a4a 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-findOneAndDelete-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-findOneAndDelete-option.yaml @@ -10,6 +10,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: hint diff --git a/docs/includes/apiargs-MongoDBCollection-method-findOneAndReplace-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-findOneAndReplace-option.yaml index 37f326cf0..b509ac947 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-findOneAndReplace-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-findOneAndReplace-option.yaml @@ -10,6 +10,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: hint diff --git a/docs/includes/apiargs-MongoDBCollection-method-findOneAndUpdate-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-findOneAndUpdate-option.yaml index 412125239..a8f895f1b 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-findOneAndUpdate-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-findOneAndUpdate-option.yaml @@ -16,6 +16,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: hint diff --git a/docs/includes/apiargs-MongoDBCollection-method-insertMany-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-insertMany-option.yaml index 391935780..60f197d2b 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-insertMany-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-insertMany-option.yaml @@ -2,6 +2,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: bypassDocumentValidation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-MongoDBCollection-method-bulkWrite-option.yaml ref: ordered diff --git a/docs/includes/apiargs-MongoDBCollection-method-insertOne-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-insertOne-option.yaml index 61d795c76..adf17cb61 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-insertOne-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-insertOne-option.yaml @@ -2,6 +2,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: bypassDocumentValidation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: session diff --git a/docs/includes/apiargs-MongoDBCollection-method-listIndexes-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-listIndexes-option.yaml index cbfb65016..aa939b950 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-listIndexes-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-listIndexes-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: maxTimeMS diff --git a/docs/includes/apiargs-MongoDBCollection-method-mapReduce-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-mapReduce-option.yaml index 97f320ee1..478d12dda 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-mapReduce-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-mapReduce-option.yaml @@ -8,6 +8,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- arg_name: option name: finalize type: :php:`MongoDB\\BSON\\Javascript ` diff --git a/docs/includes/apiargs-MongoDBCollection-method-rename-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-rename-option.yaml index 3aed74eb2..0b0b0809c 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-rename-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-rename-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-MongoDBCollection-common-option.yaml ref: typeMap diff --git a/docs/includes/apiargs-MongoDBCollection-method-replaceOne-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-replaceOne-option.yaml index dcd0847b8..676296d26 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-replaceOne-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-replaceOne-option.yaml @@ -10,6 +10,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: hint diff --git a/docs/includes/apiargs-MongoDBCollection-method-updateMany-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-updateMany-option.yaml index e102f5613..64eec34e0 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-updateMany-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-updateMany-option.yaml @@ -16,6 +16,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: hint diff --git a/docs/includes/apiargs-MongoDBCollection-method-updateOne-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-updateOne-option.yaml index e102f5613..64eec34e0 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-updateOne-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-updateOne-option.yaml @@ -16,6 +16,15 @@ source: file: apiargs-MongoDBCollection-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: hint diff --git a/docs/includes/apiargs-MongoDBCollection-method-watch-option.yaml b/docs/includes/apiargs-MongoDBCollection-method-watch-option.yaml index d785b471e..d1c426229 100644 --- a/docs/includes/apiargs-MongoDBCollection-method-watch-option.yaml +++ b/docs/includes/apiargs-MongoDBCollection-method-watch-option.yaml @@ -7,6 +7,15 @@ source: file: apiargs-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + The comment can be any valid BSON type for server versions 4.4 and above. + Earlier server versions only support string values. + + .. versionadded:: 1.13 +--- source: file: apiargs-method-watch-option.yaml ref: fullDocument diff --git a/docs/includes/apiargs-MongoDBDatabase-method-aggregate-option.yaml b/docs/includes/apiargs-MongoDBDatabase-method-aggregate-option.yaml index f24d99d2c..f59192a0f 100644 --- a/docs/includes/apiargs-MongoDBDatabase-method-aggregate-option.yaml +++ b/docs/includes/apiargs-MongoDBDatabase-method-aggregate-option.yaml @@ -11,8 +11,11 @@ source: ref: bypassDocumentValidation --- source: - file: apiargs-aggregate-option.yaml + file: apiargs-common-option.yaml ref: comment +post: | + The comment can be any valid BSON type for server versions 4.4 and above. + Earlier server versions only support string values. --- source: file: apiargs-aggregate-option.yaml diff --git a/docs/includes/apiargs-MongoDBDatabase-method-createCollection-option.yaml b/docs/includes/apiargs-MongoDBDatabase-method-createCollection-option.yaml index 82865dc16..f95b406c2 100644 --- a/docs/includes/apiargs-MongoDBDatabase-method-createCollection-option.yaml +++ b/docs/includes/apiargs-MongoDBDatabase-method-createCollection-option.yaml @@ -67,6 +67,15 @@ pre: | Specifies the :manual:`collation ` for the collection. --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- arg_name: option name: encryptedFields type: document diff --git a/docs/includes/apiargs-MongoDBDatabase-method-drop-option.yaml b/docs/includes/apiargs-MongoDBDatabase-method-drop-option.yaml index 5b3c18c33..e725fc1be 100644 --- a/docs/includes/apiargs-MongoDBDatabase-method-drop-option.yaml +++ b/docs/includes/apiargs-MongoDBDatabase-method-drop-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: session diff --git a/docs/includes/apiargs-MongoDBDatabase-method-dropCollection-option.yaml b/docs/includes/apiargs-MongoDBDatabase-method-dropCollection-option.yaml index f08f9e060..0034b5e88 100644 --- a/docs/includes/apiargs-MongoDBDatabase-method-dropCollection-option.yaml +++ b/docs/includes/apiargs-MongoDBDatabase-method-dropCollection-option.yaml @@ -4,6 +4,15 @@ source: post: | .. versionadded:: 1.13 --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: session diff --git a/docs/includes/apiargs-MongoDBDatabase-method-listCollections-option.yaml b/docs/includes/apiargs-MongoDBDatabase-method-listCollections-option.yaml index 49f41dacb..bacf7280a 100644 --- a/docs/includes/apiargs-MongoDBDatabase-method-listCollections-option.yaml +++ b/docs/includes/apiargs-MongoDBDatabase-method-listCollections-option.yaml @@ -13,6 +13,15 @@ interface: phpmethod operation: ~ optional: true --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- arg_name: option name: filter type: array|object diff --git a/docs/includes/apiargs-MongoDBDatabase-method-modifyCollection-option.yaml b/docs/includes/apiargs-MongoDBDatabase-method-modifyCollection-option.yaml index ca8d6fef1..b27c16cfb 100644 --- a/docs/includes/apiargs-MongoDBDatabase-method-modifyCollection-option.yaml +++ b/docs/includes/apiargs-MongoDBDatabase-method-modifyCollection-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: session diff --git a/docs/includes/apiargs-MongoDBDatabase-method-renameCollection-option.yaml b/docs/includes/apiargs-MongoDBDatabase-method-renameCollection-option.yaml index bf7d96638..bb026bd9c 100644 --- a/docs/includes/apiargs-MongoDBDatabase-method-renameCollection-option.yaml +++ b/docs/includes/apiargs-MongoDBDatabase-method-renameCollection-option.yaml @@ -1,3 +1,12 @@ +source: + file: apiargs-common-option.yaml + ref: comment +post: | + This is not supported for server versions prior to 4.4 and will result in an + exception at execution time if used. + + .. versionadded:: 1.13 +--- source: file: apiargs-common-option.yaml ref: session diff --git a/docs/includes/apiargs-MongoDBDatabase-method-watch-option.yaml b/docs/includes/apiargs-MongoDBDatabase-method-watch-option.yaml index 7de7df6d2..3ee3c1446 100644 --- a/docs/includes/apiargs-MongoDBDatabase-method-watch-option.yaml +++ b/docs/includes/apiargs-MongoDBDatabase-method-watch-option.yaml @@ -7,6 +7,15 @@ source: file: apiargs-common-option.yaml ref: collation --- +source: + file: apiargs-common-option.yaml + ref: comment +post: | + The comment can be any valid BSON type for server versions 4.4 and above. + Earlier server versions only support string values. + + .. versionadded:: 1.13 +--- source: file: apiargs-method-watch-option.yaml ref: fullDocument diff --git a/docs/includes/apiargs-aggregate-option.yaml b/docs/includes/apiargs-aggregate-option.yaml index 77d6d535e..c75880df2 100644 --- a/docs/includes/apiargs-aggregate-option.yaml +++ b/docs/includes/apiargs-aggregate-option.yaml @@ -27,16 +27,6 @@ post: | :ref:`$out ` stages. --- arg_name: option -name: comment -type: string -description: | - Users can specify an arbitrary string to help trace the operation through the - database profiler, currentOp, and logs. -interface: phpmethod -operation: ~ -optional: true ---- -arg_name: option name: explain type: boolean description: | diff --git a/docs/includes/apiargs-common-option.yaml b/docs/includes/apiargs-common-option.yaml index 667b35bdb..cae141871 100644 --- a/docs/includes/apiargs-common-option.yaml +++ b/docs/includes/apiargs-common-option.yaml @@ -13,6 +13,18 @@ operation: ~ optional: true --- arg_name: option +name: comment +type: mixed +description: | + Enables users to specify an arbitrary comment to help trace the operation + through the :manual:`database profiler `, + :manual:`currentOp ` output, and + :manual:`logs `. +interface: phpmethod +operation: ~ +optional: true +--- +arg_name: option name: hint type: string|array|object description: | diff --git a/src/Command/ListCollections.php b/src/Command/ListCollections.php index 100604170..8a017558f 100644 --- a/src/Command/ListCollections.php +++ b/src/Command/ListCollections.php @@ -54,6 +54,10 @@ class ListCollections implements Executable * * For servers < 4.0, this option is ignored. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * filter (document): Query by which to filter collections. * * * maxTimeMS (integer): The maximum amount of time to allow the query to @@ -104,6 +108,19 @@ public function __construct($databaseName, array $options = []) * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server) + { + $cursor = $server->executeReadCommand($this->databaseName, $this->createCommand(), $this->createOptions()); + $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); + + return new CachingIterator($cursor); + } + + /** + * Create the listCollections command. + * + * @return Command + */ + private function createCommand() { $cmd = ['listCollections' => 1]; @@ -111,16 +128,13 @@ public function execute(Server $server) $cmd['filter'] = (object) $this->options['filter']; } - foreach (['authorizedCollections', 'maxTimeMS', 'nameOnly'] as $option) { + foreach (['authorizedCollections', 'comment', 'maxTimeMS', 'nameOnly'] as $option) { if (isset($this->options[$option])) { $cmd[$option] = $this->options[$option]; } } - $cursor = $server->executeReadCommand($this->databaseName, new Command($cmd), $this->createOptions()); - $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); - - return new CachingIterator($cursor); + return new Command($cmd); } /** diff --git a/src/Command/ListDatabases.php b/src/Command/ListDatabases.php index 20c03157f..3d75fa96c 100644 --- a/src/Command/ListDatabases.php +++ b/src/Command/ListDatabases.php @@ -52,6 +52,10 @@ class ListDatabases implements Executable * * For servers < 4.0.5, this option is ignored. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * filter (document): Query by which to filter databases. * * * maxTimeMS (integer): The maximum amount of time to allow the query to @@ -101,6 +105,24 @@ public function __construct(array $options = []) * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server) + { + $cursor = $server->executeReadCommand('admin', $this->createCommand(), $this->createOptions()); + $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); + $result = current($cursor->toArray()); + + if (! isset($result['databases']) || ! is_array($result['databases'])) { + throw new UnexpectedValueException('listDatabases command did not return a "databases" array'); + } + + return $result['databases']; + } + + /** + * Create the listDatabases command. + * + * @return Command + */ + private function createCommand() { $cmd = ['listDatabases' => 1]; @@ -108,21 +130,13 @@ public function execute(Server $server) $cmd['filter'] = (object) $this->options['filter']; } - foreach (['authorizedDatabases', 'maxTimeMS', 'nameOnly'] as $option) { + foreach (['authorizedDatabases', 'comment', 'maxTimeMS', 'nameOnly'] as $option) { if (isset($this->options[$option])) { $cmd[$option] = $this->options[$option]; } } - $cursor = $server->executeReadCommand('admin', new Command($cmd), $this->createOptions()); - $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); - $result = current($cursor->toArray()); - - if (! isset($result['databases']) || ! is_array($result['databases'])) { - throw new UnexpectedValueException('listDatabases command did not return a "databases" array'); - } - - return $result['databases']; + return new Command($cmd); } /** diff --git a/src/Operation/Aggregate.php b/src/Operation/Aggregate.php index 1573c5d94..de3c1e4f0 100644 --- a/src/Operation/Aggregate.php +++ b/src/Operation/Aggregate.php @@ -86,8 +86,9 @@ class Aggregate implements Executable, Explainable * * * collation (document): Collation specification. * - * * comment (string): An arbitrary string to help trace the operation - * through the database profiler, currentOp, and logs. + * * comment (mixed): BSON value to attach as a comment to this command. + * + * Only string values are supported for server versions < 4.4. * * * explain (boolean): Specifies whether or not to return the information * on the processing of the pipeline. @@ -170,10 +171,6 @@ public function __construct($databaseName, $collectionName, array $pipeline, arr throw InvalidArgumentException::invalidType('"collation" option', $options['collation'], 'array or object'); } - if (isset($options['comment']) && ! is_string($options['comment'])) { - throw InvalidArgumentException::invalidType('"comment" option', $options['comment'], 'string'); - } - if (isset($options['explain']) && ! is_bool($options['explain'])) { throw InvalidArgumentException::invalidType('"explain" option', $options['explain'], 'boolean'); } diff --git a/src/Operation/BulkWrite.php b/src/Operation/BulkWrite.php index e80c562b5..f9096c2c5 100644 --- a/src/Operation/BulkWrite.php +++ b/src/Operation/BulkWrite.php @@ -103,6 +103,11 @@ class BulkWrite implements Executable * * bypassDocumentValidation (boolean): If true, allows the write to * circumvent document level validation. The default is false. * + * * comment (mixed): BSON value to attach as a comment to this command(s) + * associated with this bulk write. + * + * This is not supported for servers versions < 4.4. + * * * ordered (boolean): If true, when an insert fails, return without * performing the remaining writes. If false, when a write fails, * continue with the remaining writes, if any. The default is true. @@ -353,8 +358,10 @@ private function createBulkWriteOptions() { $options = ['ordered' => $this->options['ordered']]; - if (isset($this->options['bypassDocumentValidation'])) { - $options['bypassDocumentValidation'] = $this->options['bypassDocumentValidation']; + foreach (['bypassDocumentValidation', 'comment'] as $option) { + if (isset($this->options[$option])) { + $options[$option] = $this->options[$option]; + } } if (isset($this->options['let'])) { diff --git a/src/Operation/Count.php b/src/Operation/Count.php index 4d76f0a78..aff947b72 100644 --- a/src/Operation/Count.php +++ b/src/Operation/Count.php @@ -62,6 +62,10 @@ class Count implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. @@ -195,7 +199,7 @@ private function createCommandDocument() $cmd['hint'] = is_array($this->options['hint']) ? (object) $this->options['hint'] : $this->options['hint']; } - foreach (['limit', 'maxTimeMS', 'skip'] as $option) { + foreach (['comment', 'limit', 'maxTimeMS', 'skip'] as $option) { if (isset($this->options[$option])) { $cmd[$option] = $this->options[$option]; } diff --git a/src/Operation/CountDocuments.php b/src/Operation/CountDocuments.php index 6771d8d95..6e0e561f9 100644 --- a/src/Operation/CountDocuments.php +++ b/src/Operation/CountDocuments.php @@ -65,6 +65,10 @@ class CountDocuments implements Executable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * Only string values are supported for server versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. @@ -107,7 +111,7 @@ public function __construct($databaseName, $collectionName, $filter, array $opti $this->collectionName = (string) $collectionName; $this->filter = $filter; - $this->aggregateOptions = array_intersect_key($options, ['collation' => 1, 'hint' => 1, 'maxTimeMS' => 1, 'readConcern' => 1, 'readPreference' => 1, 'session' => 1]); + $this->aggregateOptions = array_intersect_key($options, ['collation' => 1, 'comment' => 1, 'hint' => 1, 'maxTimeMS' => 1, 'readConcern' => 1, 'readPreference' => 1, 'session' => 1]); $this->countOptions = array_intersect_key($options, ['limit' => 1, 'skip' => 1]); $this->aggregate = $this->createAggregate(); diff --git a/src/Operation/CreateCollection.php b/src/Operation/CreateCollection.php index 5e0d54d22..61c687730 100644 --- a/src/Operation/CreateCollection.php +++ b/src/Operation/CreateCollection.php @@ -72,6 +72,10 @@ class CreateCollection implements Executable * * capped (boolean): Specify true to create a capped collection. If set, * the size option must also be specified. The default is false. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * changeStreamPreAndPostImages (document): Used to configure support for * pre- and post-images in change streams. * @@ -285,7 +289,7 @@ private function createCommand() { $cmd = ['create' => $this->collectionName]; - foreach (['autoIndexId', 'capped', 'expireAfterSeconds', 'flags', 'max', 'maxTimeMS', 'pipeline', 'size', 'validationAction', 'validationLevel', 'viewOn'] as $option) { + foreach (['autoIndexId', 'capped', 'comment', 'expireAfterSeconds', 'flags', 'max', 'maxTimeMS', 'pipeline', 'size', 'validationAction', 'validationLevel', 'viewOn'] as $option) { if (isset($this->options[$option])) { $cmd[$option] = $this->options[$option]; } diff --git a/src/Operation/CreateIndexes.php b/src/Operation/CreateIndexes.php index 5778960c9..498b8c1ef 100644 --- a/src/Operation/CreateIndexes.php +++ b/src/Operation/CreateIndexes.php @@ -63,6 +63,10 @@ class CreateIndexes implements Executable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * commitQuorum (integer|string): Specifies how many data-bearing members * of a replica set, including the primary, must complete the index * builds successfully before the primary marks the indexes as ready. @@ -195,8 +199,10 @@ private function executeCommand(Server $server) $cmd['commitQuorum'] = $this->options['commitQuorum']; } - if (isset($this->options['maxTimeMS'])) { - $cmd['maxTimeMS'] = $this->options['maxTimeMS']; + foreach (['comment', 'maxTimeMS'] as $option) { + if (isset($this->options[$option])) { + $cmd[$option] = $this->options[$option]; + } } $server->executeWriteCommand($this->databaseName, new Command($cmd), $this->createOptions()); diff --git a/src/Operation/Delete.php b/src/Operation/Delete.php index a52d45bdf..95df96624 100644 --- a/src/Operation/Delete.php +++ b/src/Operation/Delete.php @@ -68,6 +68,10 @@ class Delete implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. @@ -194,6 +198,10 @@ private function createBulkWriteOptions(): array { $options = []; + if (isset($this->options['comment'])) { + $options['comment'] = $this->options['comment']; + } + if (isset($this->options['let'])) { $options['let'] = (object) $this->options['let']; } diff --git a/src/Operation/DeleteMany.php b/src/Operation/DeleteMany.php index d72c22ab7..3e3a73d0f 100644 --- a/src/Operation/DeleteMany.php +++ b/src/Operation/DeleteMany.php @@ -42,6 +42,10 @@ class DeleteMany implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. diff --git a/src/Operation/DeleteOne.php b/src/Operation/DeleteOne.php index 91b47954e..dda930208 100644 --- a/src/Operation/DeleteOne.php +++ b/src/Operation/DeleteOne.php @@ -42,6 +42,10 @@ class DeleteOne implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. diff --git a/src/Operation/Distinct.php b/src/Operation/Distinct.php index aefee694c..3298cda89 100644 --- a/src/Operation/Distinct.php +++ b/src/Operation/Distinct.php @@ -64,6 +64,10 @@ class Distinct implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * maxTimeMS (integer): The maximum amount of time to allow the query to * run. * @@ -187,8 +191,10 @@ private function createCommandDocument() $cmd['collation'] = (object) $this->options['collation']; } - if (isset($this->options['maxTimeMS'])) { - $cmd['maxTimeMS'] = $this->options['maxTimeMS']; + foreach (['comment', 'maxTimeMS'] as $option) { + if (isset($this->options[$option])) { + $cmd[$option] = $this->options[$option]; + } } return $cmd; diff --git a/src/Operation/DropCollection.php b/src/Operation/DropCollection.php index 2eb77890c..2ab9b8716 100644 --- a/src/Operation/DropCollection.php +++ b/src/Operation/DropCollection.php @@ -55,6 +55,10 @@ class DropCollection implements Executable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * session (MongoDB\Driver\Session): Client session. * * * typeMap (array): Type map for BSON deserialization. This will be used @@ -106,10 +110,8 @@ public function execute(Server $server) throw UnsupportedException::writeConcernNotSupportedInTransaction(); } - $command = new Command(['drop' => $this->collectionName]); - try { - $cursor = $server->executeWriteCommand($this->databaseName, $command, $this->createOptions()); + $cursor = $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); } catch (CommandException $e) { /* The server may return an error if the collection does not exist. * Check for an error code and return the command reply instead of @@ -128,6 +130,22 @@ public function execute(Server $server) return current($cursor->toArray()); } + /** + * Create the drop command. + * + * @return Command + */ + private function createCommand() + { + $cmd = ['drop' => $this->collectionName]; + + if (isset($this->options['comment'])) { + $cmd['comment'] = $this->options['comment']; + } + + return new Command($cmd); + } + /** * Create options for executing the command. * diff --git a/src/Operation/DropDatabase.php b/src/Operation/DropDatabase.php index 6d7e61713..0e569f068 100644 --- a/src/Operation/DropDatabase.php +++ b/src/Operation/DropDatabase.php @@ -48,6 +48,10 @@ class DropDatabase implements Executable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * session (MongoDB\Driver\Session): Client session. * * * typeMap (array): Type map for BSON deserialization. This will be used @@ -91,8 +95,7 @@ public function __construct($databaseName, array $options = []) */ public function execute(Server $server) { - $command = new Command(['dropDatabase' => 1]); - $cursor = $server->executeWriteCommand($this->databaseName, $command, $this->createOptions()); + $cursor = $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); if (isset($this->options['typeMap'])) { $cursor->setTypeMap($this->options['typeMap']); @@ -101,6 +104,22 @@ public function execute(Server $server) return current($cursor->toArray()); } + /** + * Create the dropDatabase command. + * + * @return Command + */ + private function createCommand() + { + $cmd = ['dropDatabase' => 1]; + + if (isset($this->options['comment'])) { + $cmd['comment'] = $this->options['comment']; + } + + return new Command($cmd); + } + /** * Create options for executing the command. * diff --git a/src/Operation/DropIndexes.php b/src/Operation/DropIndexes.php index 170cf9875..e63be7fd1 100644 --- a/src/Operation/DropIndexes.php +++ b/src/Operation/DropIndexes.php @@ -55,6 +55,10 @@ class DropIndexes implements Executable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * maxTimeMS (integer): The maximum amount of time to allow the query to * run. * @@ -142,8 +146,10 @@ private function createCommand() 'index' => $this->indexName, ]; - if (isset($this->options['maxTimeMS'])) { - $cmd['maxTimeMS'] = $this->options['maxTimeMS']; + foreach (['comment', 'maxTimeMS'] as $option) { + if (isset($this->options[$option])) { + $cmd[$option] = $this->options[$option]; + } } return new Command($cmd); diff --git a/src/Operation/EstimatedDocumentCount.php b/src/Operation/EstimatedDocumentCount.php index e4e731eec..5ed9c73b9 100644 --- a/src/Operation/EstimatedDocumentCount.php +++ b/src/Operation/EstimatedDocumentCount.php @@ -59,6 +59,10 @@ class EstimatedDocumentCount implements Executable, Explainable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * maxTimeMS (integer): The maximum amount of time to allow the query to * run. * @@ -94,7 +98,7 @@ public function __construct($databaseName, $collectionName, array $options = []) throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); } - $this->options = array_intersect_key($options, ['maxTimeMS' => 1, 'readConcern' => 1, 'readPreference' => 1, 'session' => 1]); + $this->options = array_intersect_key($options, ['comment' => 1, 'maxTimeMS' => 1, 'readConcern' => 1, 'readPreference' => 1, 'session' => 1]); } /** diff --git a/src/Operation/Explain.php b/src/Operation/Explain.php index 862e9a152..b6cec43e3 100644 --- a/src/Operation/Explain.php +++ b/src/Operation/Explain.php @@ -60,6 +60,10 @@ class Explain implements Executable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * readPreference (MongoDB\Driver\ReadPreference): Read preference. * * * session (MongoDB\Driver\Session): Client session. @@ -112,13 +116,7 @@ public function execute(Server $server) throw UnsupportedException::explainNotSupported(); } - $cmd = ['explain' => $this->explainable->getCommandDocument($server)]; - - if (isset($this->options['verbosity'])) { - $cmd['verbosity'] = $this->options['verbosity']; - } - - $cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions()); + $cursor = $server->executeCommand($this->databaseName, $this->createCommand($server), $this->createOptions()); if (isset($this->options['typeMap'])) { $cursor->setTypeMap($this->options['typeMap']); @@ -127,6 +125,25 @@ public function execute(Server $server) return current($cursor->toArray()); } + /** + * Create the explain command. + * + * @param Server $server + * @return Command + */ + private function createCommand(Server $server) + { + $cmd = ['explain' => $this->explainable->getCommandDocument($server)]; + + foreach (['comment', 'verbosity'] as $option) { + if (isset($this->options[$option])) { + $cmd[$option] = $this->options[$option]; + } + } + + return new Command($cmd); + } + /** * Create options for executing the command. * diff --git a/src/Operation/Find.php b/src/Operation/Find.php index 5371243dd..77e20ba12 100644 --- a/src/Operation/Find.php +++ b/src/Operation/Find.php @@ -78,8 +78,9 @@ class Find implements Executable, Explainable * * * collation (document): Collation specification. * - * * comment (string): Attaches a comment to the query. If "$comment" also - * exists in the modifiers document, this option will take precedence. + * * comment (mixed): BSON value to attach as a comment to this command. + * + * Only string values are supported for server versions < 4.4. * * * cursorType (enum): Indicates the type of cursor to use. Must be either * NON_TAILABLE, TAILABLE, or TAILABLE_AWAIT. The default is @@ -181,10 +182,6 @@ public function __construct($databaseName, $collectionName, $filter, array $opti throw InvalidArgumentException::invalidType('"collation" option', $options['collation'], 'array or object'); } - if (isset($options['comment']) && ! is_string($options['comment'])) { - throw InvalidArgumentException::invalidType('"comment" option', $options['comment'], 'comment'); - } - if (isset($options['cursorType'])) { if (! is_integer($options['cursorType'])) { throw InvalidArgumentException::invalidType('"cursorType" option', $options['cursorType'], 'integer'); diff --git a/src/Operation/FindAndModify.php b/src/Operation/FindAndModify.php index c99acc1c7..290b8205f 100644 --- a/src/Operation/FindAndModify.php +++ b/src/Operation/FindAndModify.php @@ -74,6 +74,10 @@ class FindAndModify implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * bypassDocumentValidation (boolean): If true, allows the write to * circumvent document level validation. * @@ -298,7 +302,7 @@ private function createCommandDocument() : (object) $this->options['update']; } - foreach (['arrayFilters', 'bypassDocumentValidation', 'hint', 'maxTimeMS'] as $option) { + foreach (['arrayFilters', 'bypassDocumentValidation', 'comment', 'hint', 'maxTimeMS'] as $option) { if (isset($this->options[$option])) { $cmd[$option] = $this->options[$option]; } diff --git a/src/Operation/FindOne.php b/src/Operation/FindOne.php index de46314ef..b75edcb1e 100644 --- a/src/Operation/FindOne.php +++ b/src/Operation/FindOne.php @@ -44,8 +44,9 @@ class FindOne implements Executable, Explainable * * * collation (document): Collation specification. * - * * comment (string): Attaches a comment to the query. If "$comment" also - * exists in the modifiers document, this option will take precedence. + * * comment (mixed): BSON value to attach as a comment to this command. + * + * Only string values are supported for server versions < 4.4. * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, diff --git a/src/Operation/FindOneAndDelete.php b/src/Operation/FindOneAndDelete.php index 9f27d30d4..03fd6e1a7 100644 --- a/src/Operation/FindOneAndDelete.php +++ b/src/Operation/FindOneAndDelete.php @@ -44,6 +44,10 @@ class FindOneAndDelete implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. diff --git a/src/Operation/FindOneAndReplace.php b/src/Operation/FindOneAndReplace.php index 879569bfc..dce8a6a97 100644 --- a/src/Operation/FindOneAndReplace.php +++ b/src/Operation/FindOneAndReplace.php @@ -53,6 +53,10 @@ class FindOneAndReplace implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. diff --git a/src/Operation/FindOneAndUpdate.php b/src/Operation/FindOneAndUpdate.php index 4951f4d0f..98b6cf42c 100644 --- a/src/Operation/FindOneAndUpdate.php +++ b/src/Operation/FindOneAndUpdate.php @@ -57,6 +57,10 @@ class FindOneAndUpdate implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. diff --git a/src/Operation/InsertMany.php b/src/Operation/InsertMany.php index 7633905fe..af7bd7361 100644 --- a/src/Operation/InsertMany.php +++ b/src/Operation/InsertMany.php @@ -60,6 +60,11 @@ class InsertMany implements Executable * * bypassDocumentValidation (boolean): If true, allows the write to * circumvent document level validation. * + * * comment (mixed): BSON value to attach as a comment to the command(s) + * associated with this insert. + * + * This is not supported for servers versions < 4.4. + * * * ordered (boolean): If true, when an insert fails, return without * performing the remaining writes. If false, when a write fails, * continue with the remaining writes, if any. The default is true. @@ -164,8 +169,10 @@ private function createBulkWriteOptions() { $options = ['ordered' => $this->options['ordered']]; - if (isset($this->options['bypassDocumentValidation'])) { - $options['bypassDocumentValidation'] = $this->options['bypassDocumentValidation']; + foreach (['bypassDocumentValidation', 'comment'] as $option) { + if (isset($this->options[$option])) { + $options[$option] = $this->options[$option]; + } } return $options; diff --git a/src/Operation/InsertOne.php b/src/Operation/InsertOne.php index 39e986683..9398f1795 100644 --- a/src/Operation/InsertOne.php +++ b/src/Operation/InsertOne.php @@ -59,6 +59,10 @@ class InsertOne implements Executable * * bypassDocumentValidation (boolean): If true, allows the write to * circumvent document level validation. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * session (MongoDB\Driver\Session): Client session. * * * writeConcern (MongoDB\Driver\WriteConcern): Write concern. @@ -135,8 +139,10 @@ private function createBulkWriteOptions() { $options = []; - if (isset($this->options['bypassDocumentValidation'])) { - $options['bypassDocumentValidation'] = $this->options['bypassDocumentValidation']; + foreach (['bypassDocumentValidation', 'comment'] as $option) { + if (isset($this->options[$option])) { + $options[$option] = $this->options[$option]; + } } return $options; diff --git a/src/Operation/ListCollectionNames.php b/src/Operation/ListCollectionNames.php index c5fc568ff..4bc5565a3 100644 --- a/src/Operation/ListCollectionNames.php +++ b/src/Operation/ListCollectionNames.php @@ -46,6 +46,10 @@ class ListCollectionNames implements Executable * * For servers < 4.0, this option is ignored. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * filter (document): Query by which to filter collections. * * * maxTimeMS (integer): The maximum amount of time to allow the query to diff --git a/src/Operation/ListCollections.php b/src/Operation/ListCollections.php index f346263e3..8a55f9908 100644 --- a/src/Operation/ListCollections.php +++ b/src/Operation/ListCollections.php @@ -49,6 +49,10 @@ class ListCollections implements Executable * * For servers < 4.0, this option is ignored. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * filter (document): Query by which to filter collections. * * * maxTimeMS (integer): The maximum amount of time to allow the query to diff --git a/src/Operation/ListDatabaseNames.php b/src/Operation/ListDatabaseNames.php index 2c15ca97e..950c82b7c 100644 --- a/src/Operation/ListDatabaseNames.php +++ b/src/Operation/ListDatabaseNames.php @@ -49,6 +49,10 @@ class ListDatabaseNames implements Executable * * For servers < 4.0.5, this option is ignored. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * filter (document): Query by which to filter databases. * * * maxTimeMS (integer): The maximum amount of time to allow the query to diff --git a/src/Operation/ListDatabases.php b/src/Operation/ListDatabases.php index abfcb2a0a..6b0c4ba2c 100644 --- a/src/Operation/ListDatabases.php +++ b/src/Operation/ListDatabases.php @@ -47,6 +47,10 @@ class ListDatabases implements Executable * * For servers < 4.0.5, this option is ignored. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * filter (document): Query by which to filter databases. * * * maxTimeMS (integer): The maximum amount of time to allow the query to diff --git a/src/Operation/ListIndexes.php b/src/Operation/ListIndexes.php index 213b7dd03..b6e8a1ea0 100644 --- a/src/Operation/ListIndexes.php +++ b/src/Operation/ListIndexes.php @@ -59,6 +59,10 @@ class ListIndexes implements Executable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * maxTimeMS (integer): The maximum amount of time to allow the query to * run. * @@ -129,8 +133,10 @@ private function executeCommand(Server $server) { $cmd = ['listIndexes' => $this->collectionName]; - if (isset($this->options['maxTimeMS'])) { - $cmd['maxTimeMS'] = $this->options['maxTimeMS']; + foreach (['comment', 'maxTimeMS'] as $option) { + if (isset($this->options[$option])) { + $cmd[$option] = $this->options[$option]; + } } try { diff --git a/src/Operation/MapReduce.php b/src/Operation/MapReduce.php index 46827b1a9..b1e8319ce 100644 --- a/src/Operation/MapReduce.php +++ b/src/Operation/MapReduce.php @@ -102,6 +102,10 @@ class MapReduce implements Executable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * finalize (MongoDB\BSON\JavascriptInterface): Follows the reduce method * and modifies the output. * @@ -339,7 +343,7 @@ private function createCommand() 'out' => $this->out, ]; - foreach (['bypassDocumentValidation', 'finalize', 'jsMode', 'limit', 'maxTimeMS', 'verbose'] as $option) { + foreach (['bypassDocumentValidation', 'comment', 'finalize', 'jsMode', 'limit', 'maxTimeMS', 'verbose'] as $option) { if (isset($this->options[$option])) { $cmd[$option] = $this->options[$option]; } diff --git a/src/Operation/ModifyCollection.php b/src/Operation/ModifyCollection.php index e6e16961d..cd52cb9a0 100644 --- a/src/Operation/ModifyCollection.php +++ b/src/Operation/ModifyCollection.php @@ -53,6 +53,10 @@ class ModifyCollection implements Executable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * session (MongoDB\Driver\Session): Client session. * * * typeMap (array): Type map for BSON deserialization. This will only be @@ -104,7 +108,7 @@ public function __construct($databaseName, $collectionName, array $collectionOpt */ public function execute(Server $server) { - $cursor = $server->executeWriteCommand($this->databaseName, new Command(['collMod' => $this->collectionName] + $this->collectionOptions), $this->createOptions()); + $cursor = $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); if (isset($this->options['typeMap'])) { $cursor->setTypeMap($this->options['typeMap']); @@ -113,6 +117,17 @@ public function execute(Server $server) return current($cursor->toArray()); } + private function createCommand(): Command + { + $cmd = ['collMod' => $this->collectionName] + $this->collectionOptions; + + if (isset($this->options['comment'])) { + $cmd['comment'] = $this->options['comment']; + } + + return new Command($cmd); + } + /** * Create options for executing the command. * diff --git a/src/Operation/RenameCollection.php b/src/Operation/RenameCollection.php index 1a02cf40f..e489713a3 100644 --- a/src/Operation/RenameCollection.php +++ b/src/Operation/RenameCollection.php @@ -52,6 +52,10 @@ class RenameCollection implements Executable * * Supported options: * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * session (MongoDB\Driver\Session): Client session. * * * typeMap (array): Type map for BSON deserialization. This will be used @@ -112,22 +116,34 @@ public function execute(Server $server) throw UnsupportedException::writeConcernNotSupportedInTransaction(); } + $cursor = $server->executeWriteCommand('admin', $this->createCommand(), $this->createOptions()); + + if (isset($this->options['typeMap'])) { + $cursor->setTypeMap($this->options['typeMap']); + } + + return current($cursor->toArray()); + } + + /** + * Create the renameCollection command. + * + * @return Command + */ + private function createCommand() + { $cmd = [ 'renameCollection' => $this->fromNamespace, 'to' => $this->toNamespace, ]; - if (isset($this->options['dropTarget'])) { - $cmd['dropTarget'] = $this->options['dropTarget']; - } - - $cursor = $server->executeWriteCommand('admin', new Command($cmd), $this->createOptions()); - - if (isset($this->options['typeMap'])) { - $cursor->setTypeMap($this->options['typeMap']); + foreach (['comment', 'dropTarget'] as $option) { + if (isset($this->options[$option])) { + $cmd[$option] = $this->options[$option]; + } } - return current($cursor->toArray()); + return new Command($cmd); } /** diff --git a/src/Operation/ReplaceOne.php b/src/Operation/ReplaceOne.php index 667813775..ef7575ddc 100644 --- a/src/Operation/ReplaceOne.php +++ b/src/Operation/ReplaceOne.php @@ -50,6 +50,10 @@ class ReplaceOne implements Executable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. diff --git a/src/Operation/Update.php b/src/Operation/Update.php index 5219ce4bb..6ec9a2ac5 100644 --- a/src/Operation/Update.php +++ b/src/Operation/Update.php @@ -77,6 +77,10 @@ class Update implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. @@ -243,8 +247,10 @@ private function createBulkWriteOptions() { $options = []; - if (isset($this->options['bypassDocumentValidation'])) { - $options['bypassDocumentValidation'] = $this->options['bypassDocumentValidation']; + foreach (['bypassDocumentValidation', 'comment'] as $option) { + if (isset($this->options[$option])) { + $options[$option] = $this->options[$option]; + } } if (isset($this->options['let'])) { diff --git a/src/Operation/UpdateMany.php b/src/Operation/UpdateMany.php index 9db83e629..27a6955ad 100644 --- a/src/Operation/UpdateMany.php +++ b/src/Operation/UpdateMany.php @@ -53,6 +53,10 @@ class UpdateMany implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. diff --git a/src/Operation/UpdateOne.php b/src/Operation/UpdateOne.php index ee8a2c32d..22a01e2a0 100644 --- a/src/Operation/UpdateOne.php +++ b/src/Operation/UpdateOne.php @@ -53,6 +53,10 @@ class UpdateOne implements Executable, Explainable * * * collation (document): Collation specification. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * This is not supported for servers versions < 4.4. + * * * hint (string|document): The index to use. Specify either the index * name as a string or the index key pattern as a document. If specified, * then the query system will only consider plans using the hinted index. diff --git a/src/Operation/Watch.php b/src/Operation/Watch.php index 2e852941a..8de7972fc 100644 --- a/src/Operation/Watch.php +++ b/src/Operation/Watch.php @@ -111,6 +111,10 @@ class Watch implements Executable, /* @internal */ CommandSubscriber * * * collation (document): Specifies a collation. * + * * comment (mixed): BSON value to attach as a comment to this command. + * + * Only string values are supported for server versions < 4.4. + * * * fullDocument (string): Determines how the "fullDocument" response * field will be populated for update operations. * @@ -239,7 +243,7 @@ public function __construct(Manager $manager, $databaseName, $collectionName, ar } } - $this->aggregateOptions = array_intersect_key($options, ['batchSize' => 1, 'collation' => 1, 'maxAwaitTimeMS' => 1, 'readConcern' => 1, 'readPreference' => 1, 'session' => 1, 'typeMap' => 1]); + $this->aggregateOptions = array_intersect_key($options, ['batchSize' => 1, 'collation' => 1, 'comment' => 1, 'maxAwaitTimeMS' => 1, 'readConcern' => 1, 'readPreference' => 1, 'session' => 1, 'typeMap' => 1]); $this->changeStreamOptions = array_intersect_key($options, ['fullDocument' => 1, 'fullDocumentBeforeChange' => 1, 'resumeAfter' => 1, 'startAfter' => 1, 'startAtOperationTime' => 1]); // Null database name implies a cluster-wide change stream diff --git a/tests/Operation/AggregateTest.php b/tests/Operation/AggregateTest.php index 8050f5dd3..db7a62b97 100644 --- a/tests/Operation/AggregateTest.php +++ b/tests/Operation/AggregateTest.php @@ -43,10 +43,6 @@ public function provideInvalidConstructorOptions() $options[][] = ['collation' => $value]; } - foreach ($this->getInvalidStringValues() as $value) { - $options[][] = ['comment' => $value]; - } - foreach ($this->getInvalidHintValues() as $value) { $options[][] = ['hint' => $value]; } diff --git a/tests/Operation/FindTest.php b/tests/Operation/FindTest.php index 3bf09c7bc..c8bc59647 100644 --- a/tests/Operation/FindTest.php +++ b/tests/Operation/FindTest.php @@ -41,10 +41,6 @@ public function provideInvalidConstructorOptions() $options[][] = ['collation' => $value]; } - foreach ($this->getInvalidStringValues() as $value) { - $options[][] = ['comment' => $value]; - } - foreach ($this->getInvalidIntegerValues() as $value) { $options[][] = ['cursorType' => $value]; } diff --git a/tests/UnifiedSpecTests/UnifiedSpecTest.php b/tests/UnifiedSpecTests/UnifiedSpecTest.php index 9fe809ebe..ada9f426d 100644 --- a/tests/UnifiedSpecTests/UnifiedSpecTest.php +++ b/tests/UnifiedSpecTests/UnifiedSpecTest.php @@ -59,58 +59,6 @@ class UnifiedSpecTest extends FunctionalTestCase 'valid-pass/entity-client-cmap-events: events are captured during an operation' => 'PHPC does not implement CMAP', 'valid-pass/expectedEventsForClient-eventType: eventType can be set to command and cmap' => 'PHPC does not implement CMAP', 'valid-pass/expectedEventsForClient-eventType: eventType defaults to command if unset' => 'PHPC does not implement CMAP', - // Change stream "comment" option is not yet implemented - 'change-streams/change-streams: Test with document comment' => 'Not yet implemented (PHPLIB-749)', - 'change-streams/change-streams: Test with document comment - pre 4.4' => 'Not yet implemented (PHPLIB-749)', - 'change-streams/change-streams: Test with string comment' => 'Not yet implemented (PHPLIB-749)', - 'change-streams/change-streams: Test that comment is set on getMore' => 'Not yet implemented (PHPLIB-749)', - 'change-streams/change-streams: Test that comment is not set on getMore - pre 4.4' => 'Not yet implemented (PHPLIB-749)', - // CRUD "comment" option is not yet implemented - 'crud/bulkWrite-comment: BulkWrite with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/bulkWrite-comment: BulkWrite with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/bulkWrite-comment: BulkWrite with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/countDocuments-comment: countDocuments with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/countDocuments-comment: countDocuments with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/estimatedDocumentCount-comment: estimatedDocumentCount with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/estimatedDocumentCount-comment: estimatedDocumentCount with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/estimatedDocumentCount-comment: estimatedDocumentCount with document comment - pre 4.4.14, server error' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/deleteMany-comment: deleteMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/deleteMany-comment: deleteMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/deleteMany-comment: deleteMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/deleteOne-comment: deleteOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/deleteOne-comment: deleteOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/deleteOne-comment: deleteOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/find-comment: find with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/find-comment: find with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/find-comment: find with document comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/find-comment: find with comment sets comment on getMore' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndDelete-comment: findOneAndDelete with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndDelete-comment: findOneAndDelete with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndDelete-comment: findOneAndDelete with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndReplace-comment: findOneAndReplace with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndReplace-comment: findOneAndReplace with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndReplace-comment: findOneAndReplace with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndUpdate-comment: findOneAndUpdate with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndUpdate-comment: findOneAndUpdate with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/findOneAndUpdate-comment: findOneAndUpdate with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/insertMany-comment: insertMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/insertMany-comment: insertMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/insertMany-comment: insertMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/insertOne-comment: insertOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/insertOne-comment: insertOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/insertOne-comment: insertOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/replaceOne-comment: ReplaceOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/replaceOne-comment: ReplaceOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/replaceOne-comment: ReplaceOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/updateMany-comment: UpdateMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/updateMany-comment: UpdateMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/updateMany-comment: UpdateMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/updateOne-comment: UpdateOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/updateOne-comment: UpdateOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/updateOne-comment: UpdateOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/aggregate: aggregate with comment sets comment on getMore' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/aggregate: aggregate with a document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', - 'crud/aggregate: aggregate with a document comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)', ]; /** @var UnifiedTestRunner */ diff --git a/tests/UnifiedSpecTests/Util.php b/tests/UnifiedSpecTests/Util.php index 82047934c..0e43addf4 100644 --- a/tests/UnifiedSpecTests/Util.php +++ b/tests/UnifiedSpecTests/Util.php @@ -72,31 +72,31 @@ final class Util ], Collection::class => [ 'aggregate' => ['pipeline', 'session', 'useCursor', 'allowDiskUse', 'batchSize', 'bypassDocumentValidation', 'collation', 'comment', 'explain', 'hint', 'let', 'maxAwaitTimeMS', 'maxTimeMS'], - 'bulkWrite' => ['let', 'requests', 'session', 'ordered', 'bypassDocumentValidation'], - 'createChangeStream' => ['pipeline', 'session', 'fullDocument', 'fullDocumentBeforeChange', 'resumeAfter', 'startAfter', 'startAtOperationTime', 'batchSize', 'collation', 'maxAwaitTimeMS'], + 'bulkWrite' => ['let', 'requests', 'session', 'ordered', 'bypassDocumentValidation', 'comment'], + 'createChangeStream' => ['pipeline', 'session', 'fullDocument', 'fullDocumentBeforeChange', 'resumeAfter', 'startAfter', 'startAtOperationTime', 'batchSize', 'collation', 'maxAwaitTimeMS', 'comment'], 'createFindCursor' => ['filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'limit', 'max', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'min', 'modifiers', 'noCursorTimeout', 'oplogReplay', 'projection', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'], - 'createIndex' => ['keys', 'commitQuorum', 'maxTimeMS', 'name', 'session'], - 'dropIndex' => ['name', 'session', 'maxTimeMS'], - 'count' => ['filter', 'session', 'collation', 'hint', 'limit', 'maxTimeMS', 'skip'], - 'countDocuments' => ['filter', 'session', 'limit', 'skip', 'collation', 'hint', 'maxTimeMS'], - 'estimatedDocumentCount' => ['session', 'maxTimeMS'], - 'deleteMany' => ['let', 'filter', 'session', 'collation', 'hint'], - 'deleteOne' => ['let', 'filter', 'session', 'collation', 'hint'], - 'findOneAndDelete' => ['let', 'filter', 'session', 'projection', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'new', 'sort', 'update', 'upsert'], - 'distinct' => ['fieldName', 'filter', 'session', 'collation', 'maxTimeMS'], - 'drop' => ['session'], + 'createIndex' => ['keys', 'commitQuorum', 'maxTimeMS', 'name', 'session', 'comment'], + 'dropIndex' => ['name', 'session', 'maxTimeMS', 'comment'], + 'count' => ['filter', 'session', 'collation', 'hint', 'limit', 'maxTimeMS', 'skip', 'comment'], + 'countDocuments' => ['filter', 'session', 'limit', 'skip', 'collation', 'hint', 'maxTimeMS', 'comment'], + 'estimatedDocumentCount' => ['session', 'maxTimeMS', 'comment'], + 'deleteMany' => ['let', 'filter', 'session', 'collation', 'hint', 'comment'], + 'deleteOne' => ['let', 'filter', 'session', 'collation', 'hint', 'comment'], + 'findOneAndDelete' => ['let', 'filter', 'session', 'projection', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'new', 'sort', 'update', 'upsert', 'comment'], + 'distinct' => ['fieldName', 'filter', 'session', 'collation', 'maxTimeMS', 'comment'], + 'drop' => ['session', 'comment'], 'find' => ['let', 'filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'limit', 'max', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'min', 'modifiers', 'noCursorTimeout', 'oplogReplay', 'projection', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'], 'findOne' => ['let', 'filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'max', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'min', 'modifiers', 'noCursorTimeout', 'oplogReplay', 'projection', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'], - 'findOneAndReplace' => ['let', 'returnDocument', 'filter', 'replacement', 'session', 'projection', 'returnDocument', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'new', 'remove', 'sort'], - 'rename' => ['to'], - 'replaceOne' => ['let', 'filter', 'replacement', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint'], - 'findOneAndUpdate' => ['let', 'returnDocument', 'filter', 'update', 'session', 'upsert', 'projection', 'remove', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'sort'], - 'updateMany' => ['let', 'filter', 'update', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint'], - 'updateOne' => ['let', 'filter', 'update', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint'], - 'insertMany' => ['options', 'documents', 'session', 'ordered', 'bypassDocumentValidation'], - 'insertOne' => ['document', 'session', 'bypassDocumentValidation'], - 'listIndexes' => ['session', 'maxTimeMS'], - 'mapReduce' => ['map', 'reduce', 'out', 'session', 'bypassDocumentValidation', 'collation', 'finalize', 'jsMode', 'limit', 'maxTimeMS', 'query', 'scope', 'sort', 'verbose'], + 'findOneAndReplace' => ['let', 'returnDocument', 'filter', 'replacement', 'session', 'projection', 'returnDocument', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'new', 'remove', 'sort', 'comment'], + 'rename' => ['to', 'comment'], + 'replaceOne' => ['let', 'filter', 'replacement', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'comment'], + 'findOneAndUpdate' => ['let', 'returnDocument', 'filter', 'update', 'session', 'upsert', 'projection', 'remove', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'sort', 'comment'], + 'updateMany' => ['let', 'filter', 'update', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'comment'], + 'updateOne' => ['let', 'filter', 'update', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'comment'], + 'insertMany' => ['options', 'documents', 'session', 'ordered', 'bypassDocumentValidation', 'comment'], + 'insertOne' => ['document', 'session', 'bypassDocumentValidation', 'comment'], + 'listIndexes' => ['session', 'maxTimeMS', 'comment'], + 'mapReduce' => ['map', 'reduce', 'out', 'session', 'bypassDocumentValidation', 'collation', 'finalize', 'jsMode', 'limit', 'maxTimeMS', 'query', 'scope', 'sort', 'verbose', 'comment'], ], ChangeStream::class => [ 'iterateUntilDocumentOrError' => [],