Unable to have 2 unique field together in timeseries collection

hey guys i am new to mongo db
we are using mongo db for recording candlestick information with timeseries collection

but we want to avoid duplicate data
i created a time series collection:

       timeseries: {
          timeField: "timestamp",
          metaField: "symbol",
          granularity: "seconds"

i created my index

    "timestamp": 1,
    "symbol": 1
        name: "symbol_timestamp",
        sparse: true

but i can pass unique:true

"message" : "Unique indexes are not supported on collections clustered by _id",
"ok" : 0,
"code" : 72,
"codeName" : "InvalidOptions"

how i avoid duplicate data in mongo db timeseries collection???
i need unique 2 field (symbol, timestamp)

this is how i insert my data

    timestamp: ISODate('2019-01-01T13:15:00.000Z'),
    symbol: 'SNX',

        open: 0.040613,
        high: 0.040613,
        volume: 3286.08613337,
        close: 0.040123,
        exchange: 'kucoin',
        low: 0.039847,
1 Like

Unique Index is not possible in Timeseries for now:

These index types aren’t supported:

  • [Text]
  • [2d]

These index properties aren’t supported:

  • [TTL]
  • [Unique] "

I hope it’s will be changed in next released.

best regards,


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.