Skip to content

Commit a9e1064

Browse files
committed
Fix helper scripts to check the version
1 parent 6e1a575 commit a9e1064

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.github/workflows/install_mongosh.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ MONGOSH=$2
1414

1515
PLATFORM="linux-x64"
1616

17-
if (( $(echo "$MONGODB < 6.0" | bc -l) )); then
18-
echo "mongosh is not needed for MongoDB versions less than 6.0"
19-
exit 0
17+
# Extract major version explicitly
18+
MONGODB_MAJOR_VERSION=$(echo "$MONGODB" | cut -d'.' -f1)
19+
20+
# Check if MongoDB major version is greater than or equal to 6
21+
if [ "$MONGODB_MAJOR_VERSION" -lt 6 ]; then
22+
echo "mongosh is not needed for MongoDB versions less than 6.0"
23+
exit 0
2024
fi
2125

2226
DOWNLOAD_URL="https://downloads.mongodb.com/compass/mongosh-${MONGOSH}-${PLATFORM}.tgz"
2327
TARBALL="mongosh-${MONGOSH}-${PLATFORM}.tgz"
2428

2529
echo "Downloading mongosh ${MONGOSH} for ${PLATFORM}..."
26-
if ! wget -q --show-progress "$DOWNLOAD_URL"; then
30+
if ! wget --quiet "$DOWNLOAD_URL"; then
2731
echo "Failed to download mongosh. Please check the version and your internet connection."
2832
exit 1
2933
fi

.github/workflows/start_mongo.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ mongodb_dir=$(find ${PWD}/ -type d -name "mongodb-linux-x86_64*")
77
mkdir $mongodb_dir/data
88

99
args=(--dbpath $mongodb_dir/data --logpath $mongodb_dir/mongodb.log --fork --replSet mongoengine)
10-
if (( $(echo "$MONGODB > 3.8" | bc -l) )); then
10+
11+
# Parse version components
12+
MAJOR=$(echo "$MONGODB" | cut -d'.' -f1)
13+
MINOR=$(echo "$MONGODB" | cut -d'.' -f2)
14+
if [ "$MAJOR" -gt 3 ] || ([ "$MAJOR" -eq 3 ] && [ "$MINOR" -ge 8 ]); then
1115
args+=(--setParameter maxTransactionLockRequestTimeoutMillis=1000)
1216
fi
1317

1418
$mongodb_dir/bin/mongod "${args[@]}"
1519

16-
if (( $(echo "$MONGODB < 6.0" | bc -l) )); then
20+
if [ "$MAJOR" -lt 6 ]; then
1721
mongo --verbose --eval "rs.initiate()"
1822
mongo --quiet --eval "rs.status().ok"
1923
else

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Dependencies
5858
All of the dependencies can easily be installed via `python -m pip <https://pip.pypa.io/>`_.
5959
At the very least, you'll need these two packages to use MongoEngine:
6060

61-
- pymongo>=3.4
61+
- pymongo>=3.12
6262

6363
If you utilize a ``DateTimeField``, you might also use a more flexible date parser:
6464

0 commit comments

Comments
 (0)