title: How to Insert A Non-String Object as a Key in Database
body: <p>right now I am using <strong>mongoDB</strong> and faces key error based on the datatype restriction to &quot;String&quot; only.</p>
  <blockquote>
  <p>InvalidDocument: documents must have only string keys, key was ('good', 'beneficial')</p>
  </blockquote>
  <p>The action I had tried is following:</p>
  <h3>1) Create a database named in 'glot'</h3>
  <h3>2) Make a collection with name &quot;usr_history&quot;</h3>
  <h3>3) Try to insert a usr_history document into the collection</h3>
  <p>with following command in jupyter-notebook</p>
  <pre><code>import pymongo
  
  from pymongo import MongoClient
  
  client = MongoClient() #to run the mongod instance we need a client to run it
  
  db = client['glot'] #we connect to 'test-database' with the pre-defined client instance
  
  collection = db['usr_history']
  
  edge_attr = {('good','beneficial'):&quot;good is beneficial&quot;, ('beneficial','supportive'):&quot;beneficial means something supportive&quot;} #create this with glat_algo
  
  usr_history = {&quot;nodes&quot;: ['good', 'beneficial', 'supportive'], &quot;edges&quot;: [('good', 'beneficial'), ('beneficial', 'supportive')], &quot;rephrase&quot;: edge_attr}
  
  collection.insert_one(usr_history)
  </code></pre>
  <p>and the last command returns error as the above mentioned.</p>
  <p>Basically what I am trying to do is to store the (vertex, edge, edge_attr) data into <strong>any</strong> DB so that I can keep tracking of larage amount of usr_history data for analyzing those using python.</p>
  <p>I am not confined to mongoDB, so you can give me a guideline or solution not just with mongoDB, but with another alternatives.</p>
  <p>Thank you very much.</p>