Mongodb service replica set

I’m trying to start the mongodb service with the replSet option:

jobs:
  build:
    services:
      mongodb:
        image: mongo:4.2
        options: >-
          --replSet rs0
        ports:
          - 27017:27017

This is similar to how options are used in PostgreSQL:

jobs:
  # Label of the container job
  container-job:
    # Containers must run in Linux based operating systems
    runs-on: ubuntu-latest
    # Docker Hub image that `container-job` executes in
    container: node:10.18-jessie

    # Service containers to run with `container-job`
    services:
      # Label used to access the service container
      postgres:
        # Docker Hub image
        image: postgres
        # Provide the password for postgres
        env:
          POSTGRES_PASSWORD: postgres
        # Set health checks to wait until postgres has started
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

However, running the above action results in an error:

2021-06-06T07:45:14.4844559Z ##[group]Starting mongodb service container
2021-06-06T07:45:14.4846180Z ##[command]/usr/bin/docker pull mongo:4.2
2021-06-06T07:45:14.7513851Z 4.2: Pulling from library/mongo
2021-06-06T07:45:14.7515191Z Digest: sha256:ae549cd7d5c48b36324519d3e0b6b2abb3058a3459168b939c8e9b35f6f8ee24
2021-06-06T07:45:14.7516652Z Status: Image is up to date for mongo:4.2
2021-06-06T07:45:14.7517687Z docker.io/library/mongo:4.2
2021-06-06T07:45:14.7530518Z ##[command]/usr/bin/docker create --name f89b429bfcf8488b9dc36d98e17a1ca0_mongo42_a5273d --label 6a7b4d --network github_network_83843663b2cb44559e86c6cd5ad76e1f --network-alias mongodb -p 27017:27017 --replSet rs0 -e GITHUB_ACTIONS=true -e CI=true mongo:4.2
2021-06-06T07:45:15.1784992Z unknown flag: --replSet
2021-06-06T07:45:15.1786033Z See 'docker create --help'.
2021-06-06T07:45:15.1846791Z ##[error]Exit code 125 returned from process: file name '/usr/bin/docker', arguments 'create --name f89b429bfcf8488b9dc36d98e17a1ca0_mongo42_a5273d --label 6a7b4d --network github_network_83843663b2cb44559e86c6cd5ad76e1f --network-alias mongodb -p 27017:27017 --replSet rs0 -e GITHUB_ACTIONS=true -e CI=true mongo:4.2'.
2021-06-06T07:45:15.2110355Z Stop and remove container: 0d14d6401f1443a58ba2fca52c7ebd29_log10logbase_6150cd