ADF to Generate 24 char hex string from input string field for ObjectID of Cosmos RRS feed

  • Question

  • For upsert logic to work on Cosmos using ADF, the input document should have a 24 digit hex string. 

    Any other length is not accepted by ADF because that is a default driver setting to Cosmos Mongo API sink which has MongoDB BSON driver behind the scenes. 

    Question is : How to generate a 24 char hex string using ADF data flow? there are MD5 and SHA functions which generates 32/40/64 Chars but not 24. 

    Any help is greatly appreciated.

    Friday, October 18, 2019 4:04 PM


  • @MartinJaffer

    substring(sha256(),24) may give duplicate results and may be hard to catch during execution. 

    I did not find any way in ADF to get a 24 char hex from a string. I abandoned the idea and went ahead with a different solution. 

    The _id on the Cosmos Mongo document need not be an Object ID. I tested it with a string (any length) and it worked fine. 

    So converting any string to 24 char hex is no longer needed.

    • Marked as answer by Shanmuk Aluri Tuesday, November 5, 2019 4:50 PM
    Tuesday, November 5, 2019 4:50 PM

All replies