Skip to content

feature/gha #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ functions:
API_VERSION=${API_VERSION} \
CRYPT_SHARED_LIB_PATH=${CRYPT_SHARED_LIB_PATH} \
MONGODB_URI="${MONGODB_URI}" \
MONGODB_SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI}" \
MONGODB_MULTI_MONGOS_LB_URI="${MULTI_MONGOS_LB_URI}" \
PHP_VERSION=${PHP_VERSION} \
SKIP_CRYPT_SHARED=${SKIP_CRYPT_SHARED} \
SSL=${SSL} \
Expand Down
25 changes: 20 additions & 5 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH:-}" # Optional path to crypt_shar
DRIVER_MONGODB_VERSION=${DRIVER_MONGODB_VERSION:-} # Required if IS_MATRIX_TESTING is "true"
IS_MATRIX_TESTING=${IS_MATRIX_TESTING:-} # Specify "true" to enable matrix testing. Defaults to empty string. If "true", DRIVER_MONGODB_VERSION and MONGODB_VERSION will also be checked.
MONGODB_URI=${MONGODB_URI:-} # Connection string (including credentials and topology info)
MONGODB_SINGLE_MONGOS_LB_URI=${MONGODB_SINGLE_MONGOS_LB_URI:-} # Single-mongos LB connection string
MONGODB_MULTI_MONGOS_LB_URI=${MONGODB_MULTI_MONGOS_LB_URI:-} # Multi-mongos LB connection string
MONGODB_VERSION=${MONGODB_VERSION:-} # Required if IS_MATRIX_TESTING is "true"
SKIP_CRYPT_SHARED="${SKIP_CRYPT_SHARED:-no}" # Specify "yes" to ignore CRYPT_SHARED_LIB_PATH. Defaults to "no"
SSL=${SSL:-no} # Specify "yes" to enable SSL. Defaults to "no"
Expand Down Expand Up @@ -44,14 +46,25 @@ fi
# Enable verbose output to see skipped and incomplete tests
PHPUNIT_OPTS="${PHPUNIT_OPTS} -v --configuration phpunit.evergreen.xml"

# Determine if MONGODB_URI already has a query string
SUFFIX=$(echo "$MONGODB_URI" | grep -Eo "\?(.*)" | cat)

if [ "$SSL" = "yes" ]; then
SSL_OPTS="ssl=true&sslallowinvalidcertificates=true"

# Determine if MONGODB_URI already has a query string
SUFFIX=$(echo "$MONGODB_URI" | grep -Eo "\?(.*)" | cat)

if [ -z "$SUFFIX" ]; then
MONGODB_URI="${MONGODB_URI}/?ssl=true&sslallowinvalidcertificates=true"
MONGODB_URI="${MONGODB_URI}/?${SSL_OPTS}"
else
MONGODB_URI="${MONGODB_URI}&ssl=true&sslallowinvalidcertificates=true"
MONGODB_URI="${MONGODB_URI}&${SSL_OPTS}"
fi

# Assume LB URIs already have a query string (e.g. "?loadBalanced=true")
if [ -n "${MONGODB_SINGLE_MONGOS_LB_URI}" ]; then
MONGODB_SINGLE_MONGOS_LB_URI="${MONGODB_SINGLE_MONGOS_LB_URI}&${SSL_OPTS}"
fi

if [ -n "${MONGODB_MULTI_MONGOS_LB_URI}" ]; then
MONGODB_MULTI_MONGOS_LB_URI="${MONGODB_MULTI_MONGOS_LB_URI}&${SSL_OPTS}"
fi
fi

Expand All @@ -65,6 +78,8 @@ export SYMFONY_DEPRECATIONS_HELPER=999999
export API_VERSION="${API_VERSION}"
export CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}"
export MONGODB_URI="${MONGODB_URI}"
export MONGODB_SINGLE_MONGOS_LB_URI="${MONGODB_SINGLE_MONGOS_LB_URI}"
export MONGODB_MULTI_MONGOS_LB_URI="${MONGODB_MULTI_MONGOS_LB_URI}"

# Run the tests, and store the results in a junit result file
case "$TESTS" in
Expand Down
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.* export-ignore
*.md export-ignore
tests export-ignore
docs export-ignore
examples export-ignore
mongo-orchestration export-ignore
tools export-ignore
Makefile export-ignore
phpcs.xml.dist export-ignore
phpunit.evergreen.xml export-ignore
phpunit.xml.dist export-ignore
psalm.xml.dist export-ignore
psalm-baseline.xml export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"

- name: Setup cache environment
id: extcache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"

- name: Setup cache environment
id: extcache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
with:
fetch-depth: 2

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBClient-selectCollection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ with a custom read preference:
'test',
'users',
[
'readPreference' => new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY),
'readPreference' => new MongoDB\Driver\ReadPreference('primaryPreferred'),
]
);

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBClient-selectDatabase.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ preference:
$db = $client->selectDatabase(
'test',
[
'readPreference' => new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY),
'readPreference' => new MongoDB\Driver\ReadPreference('primaryPreferred'),
]
);

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBCollection-getReadConcern.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Example
<?php

$collection = (new MongoDB\Client)->selectCollection('test', 'users', [
'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::MAJORITY),
'readConcern' => new MongoDB\Driver\ReadConcern('majority'),
]);

var_dump($collection->getReadConcern());
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBCollection-updateMany.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The following example updates all of the documents with the ``borough`` of

$updateResult = $collection->updateMany(
[ 'borough' => 'Queens' ],
[ '$set' => [ 'active' => 'True' ]]
[ '$set' => [ 'active' => true ]]
);

printf("Matched %d document(s)\n", $updateResult->getMatchedCount());
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBCollection-withOptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ preference:
$collection = (new MongoDB\Client)->selectCollection('test', 'restaurants');

$newCollection = $sourceCollection->withOptions([
'readPreference' => new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY),
'readPreference' => new MongoDB\Driver\ReadPreference('primaryPreferred'),
]);

See Also
Expand Down
23 changes: 14 additions & 9 deletions docs/reference/method/MongoDBDatabase-command.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Definition

.. phpmethod:: MongoDB\\Database::command()

Execute a :manual:`command </reference/command>` on the database.
Execute a :manual:`command </reference/command>` on the database. This is
generally used to execute commands that do not have a corresponding helper
method within the library.

.. code-block:: php

Expand Down Expand Up @@ -43,9 +45,10 @@ Errors/Exceptions
Example
-------

The following example executes a :manual:`ping
</reference/command/ping>` command, which returns a cursor with a single
result document:
Most database commands return a single result document, which can be obtained by
converting the returned cursor to an array and accessing its first element. The
following example executes a :manual:`ping </reference/command/ping>` command
and prints its result document:

.. code-block:: php

Expand All @@ -55,7 +58,7 @@ result document:

$cursor = $database->command(['ping' => 1]);

var_dump($c->toArray()[0]);
var_dump($cursor->toArray()[0]);

The output would resemble:

Expand All @@ -69,9 +72,11 @@ The output would resemble:
}
}

The following example executes a :manual:`listCollections
</reference/command/listCollections>` command, which returns a cursor with
multiple result documents:
Some database commands return a cursor with multiple results. The following
example executes :manual:`listCollections </reference/command/listCollections>`,
which returns a cursor containing a result document for each collection in the
``test`` database. Note that this example is illustrative; applications would
generally use :phpmethod:`MongoDB\\Database::listCollections()` in practice.

.. code-block:: php

Expand All @@ -81,7 +86,7 @@ multiple result documents:

$cursor = $database->command(['listCollections' => 1]);

var_dump($c->toArray());
var_dump($cursor->toArray());

The output would resemble:

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBDatabase-getReadConcern.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Example
<?php

$database = (new MongoDB\Client)->selectDatabase('test', [
'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::MAJORITY),
'readConcern' => new MongoDB\Driver\ReadConcern('majority'),
]);

var_dump($database->getReadConcern());
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBDatabase-selectCollection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ database with a custom read preference:
$users = $db->selectCollection(
'users',
[
'readPreference' => new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY),
'readPreference' => new MongoDB\Driver\ReadPreference('primaryPreferred'),
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ database with a custom read preference:

$imagesBucket = $db->selectGridFSBucket([
'bucketName' => 'images',
'readPreference' => new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY),
'readPreference' => new MongoDB\Driver\ReadPreference('primaryPreferred'),
]);

See Also
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBDatabase-withOptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ preference:
$db = (new MongoDB\Client)->test;

$newDb = $db->withOptions([
'readPreference' => new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY),
'readPreference' => new MongoDB\Driver\ReadPreference('primaryPreferred'),
]);

See Also
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Example

$database = (new MongoDB\Client)->selectDatabase('test');
$bucket = $database->selectGridFSBucket([
'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::MAJORITY),
'readConcern' => new MongoDB\Driver\ReadConcern('majority'),
]);

var_dump($bucket->getReadConcern());
Expand Down
8 changes: 6 additions & 2 deletions docs/reference/method/MongoDBModelIndexInfo-isGeoHaystack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ Definition

.. phpmethod:: MongoDB\\Model\\IndexInfo::isGeoHaystack()

Return whether the index is a :manual:`geoHaystack
</core/geohaystack>` index.
Return whether the index is a :manual:`geoHaystack </core/geohaystack>`
index.

.. code-block:: php

function isGeoHaystack(): boolean

.. note::

MongoDB 5.0 and later no longer supports geoHaystack indexes.

Return Values
-------------

Expand Down
Loading