Atlas Administration API Request Body Schema Problems - Create Rolling Index

Hello!

I’m running into unexpected behavior with the createRollingIndexes endpoint on the Atlas Administration API 2.0:
https://mongodb.prakticum-team.ru/docs/atlas/reference/api-resources-spec/v2/#tag/Rolling-Index/operation/createRollingIndex

The endpoint allows for an options object to be sent in the request body, but I am unable to pass in a value for “unique” within this options object. Attempting to define options.unique results in the following error:
{“detail”:“Unexpected error.”,“error”:500,“errorCode”:“UNEXPECTED_ERROR”,“parameters”:,“reason”:“Internal Server Error”

Some curl commands and their outcomes:
1.

curl --user "<PUB>:<PRIV>" \
  --digest \
  --header "Accept: application/vnd.atlas.2023-01-01+json" \
  --header "Content-Type: application/json" \
  -d '{
  "collection": "my-collection",
  "db": "my-db",
  "keys": [
    {
      "myfield": "1"
    }
  ],
  "options": {
    "name": "curl-test",
    "unique": true
  }
}' \
  -X POST "https://mongodb.prakticum-team.ru/proxy/cloud.mongodb.com/api/atlas/v2/groups/<GROUP_ID>/clusters/<CLUSTER>/index"

Result: {“detail”:“Unexpected error.”,“error”:500,“errorCode”:“UNEXPECTED_ERROR”,“parameters”:,“reason”:“Internal Server Error”}

curl --user "<PUB>:<PRIV>" \
  --digest \
  --header "Accept: application/vnd.atlas.2023-01-01+json" \
  --header "Content-Type: application/json" \
  -d '{
  "collection": "my-collection",
  "db": "my-db",
  "keys": [
    {
      "myfield": "1"
    }
  ],
  "options": {
    "name": "curl-test"
  }
}' \
  -X POST "https://mongodb.prakticum-team.ru/proxy/cloud.mongodb.com/api/atlas/v2/groups/<GROUP_ID>/clusters/<CLUSTER>/index"

Result: {}, status code 202

It appears that this endpoint does not like the “unique” option even though it should be valid based on the documentation. I confirmed this to be my issue based on the above examples. I also tried defining the value as a string instead of a boolean, but that didn’t work either.

Curious to hear if anybody is able to confirm that this is a bug on the mongodb side, or if I am doing something incorrectly!

Hi @Niko_Raisanen

From the api doc for options, added emphasis:

Flag that indicates whether this index can accept insertion or update of documents when the index key value matches an existing index key value. Set "unique" : true to set this index as unique. You can’t set a hashed index to be unique. This option applies to all index types. This option is unsupported for rolling indexes.