Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-21419

FIWARE.Question.Tech.Is there any way to align the order of data written to Mongo with the index order created by Cygnus?.

    Details

      Description

      Created question in FIWARE Q/A platform on 30-05-2023 at 07:05
      Please, ANSWER this question AT https://stackoverflow.com/questions/76362621/is-there-any-way-to-align-the-order-of-data-written-to-mongo-with-the-index-orde

      Question:
      Is there any way to align the order of data written to Mongo with the index order created by Cygnus?

      Description:
      I am investigating Cyguns for Fiware Orion historical data persistence.
      Since Cygnus 3.0.0, indexes are created according to the data model when writing to MongoDB, but the order of the indexes created and the data written to MongoDB are different.
      I tried it and found that the following indexes were created.
      > db['sth_/_Car1_Car'].getIndexes()
      [
      {
      "v" : 2,
      "key" :

      { "_id" : 1 }

      ,
      "name" : "id"
      },
      {
      "v" : 2,
      "key" :

      { "recvTime" : 1, "attrName" : 1, "attrType" : 1, "attrValue" : 1 }

      ,
      "name" : "cyg_raw_opt"
      }
      ]

      However, the data written from Cygnus to MongoDB is in the following order, so it seems that the index is not valid.
      > db['sth_/_Car1_Car'].find()

      { "_id" : ObjectId("6475a09a91bf560e1ef4cb0d"), "attrName" : "speed", "attrType" : "Float", "attrValue" : 80, "recvTime" : ISODate("2023-05-30T07:07:05.588Z") } { "_id" : ObjectId("6475a09f91bf560e1ef4cb0e"), "attrName" : "speed", "attrType" : "Float", "attrValue" : 70, "recvTime" : ISODate("2023-05-30T07:07:11.584Z") }

      I checked some past Issues and found that the data was lined up in the same order as the index.(ex.https://github.com/telefonicaid/fiware-cygnus/issues/2204
      What settings are needed to make this order?
      My environment is as follows:

      Cygnus 3.1.0
      MongoDB 4.4

      Thank you in advance.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        7d 23h 59m 1 Backlog Manager 08/Jun/23 7:31 AM
        In Progress In Progress Answered Answered
        1d 1 Backlog Manager 09/Jun/23 7:32 AM
        Answered Answered Closed Closed
        20d 1 Backlog Manager 29/Jun/23 7:32 AM

          People

          • Assignee:
            Unassigned
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: