title: How to get ordered dictionaries in pymongo?
body: <p>I am trying get ordered dictionaries in Pymongo.  I have read it can be done with bson.son.Son.  The Docs are <a href="http://api.mongodb.org/python/current/api/bson/son.html" rel="noreferrer">Here</a></p>
  
  <p>However, I can't seem to make it work.  There is not much on google about it.  There are some discussions on configuring pymongo first to tell it to use SON objects but no examples.  A friend suggested passing a param when you do a find.  He couldn't remember.</p>
  
  <p>I'm able to create the SON objects. But when they get inserted into the DB and then come back out they are just plain dicts.</p>
  
  <p>I'm not sure really what code example to give you because I really don't know where to start.  The below snippet creates an empty SON object every time I add a new user.  The 'sub_users' object was also created with SON.  When I read the account document back from the DB they are just normal python dicts.</p>
  
  <pre><code>    account['sub_users'][sub_user_name] = bson.SON()
      with mongo_manager.Collection(CFG.db, 'Users') as users:
          users.save(account)
  </code></pre>
  
  <p>Maybe a param past to the find like this to configure?  This was my friends suggestion but he could not remember.</p>
  
  <pre><code>with mongo_manager.Collection(CFG.db, 'Users') as users:                                 
      account = users.find_one({'_id': _id, 'DOC':'OrderedDict})
  </code></pre>
  
  <p>Any ideas?</p>