1 Reply Latest reply on Jan 13, 2014 7:14 PM by Ramesh Reddy

    MongoDB:  how do map ObjectID?

    Ivan Chan Apprentice

      Hi, I am looking at MongoDB translator page, MongoDB Translator - Teiid 8.7 (draft) - Project Documentation Editor.  I can't how a way to map ObjectID for MongoDB translator.  Can I map it to String when I define JDBC schema text?  Or is it not useable in MongoDB Translator?

       

      Thanks,

       

      Ivan

        • 1. Re: MongoDB:  how do map ObjectID?
          Ramesh Reddy Master

          Ivan,

           

          Are you working with existing MongoDB document? If yes, in that case you can map an additional column in your source table as string. For new MongoDB documents that are generated through Teiid translator, what I have done is, instead of using the MongoDB generated ObjectID, I mapped the ObjectID element to the PK column of the table. So, the value of ObectID becomes whatever the PK value that is being inserted. It can even support composite primary keys to represent ObjectID. Note that a PK column's "NameInSource" is automatically set to to "ObjectID", since MongoDB requires column with name "id".

           

          HTH.

           

          Ramesh..