Create script that can output MongoDB tables into BSON format

XMLWordPrintableJSON

    • None
    • None

      For debugging purposes, it would be helpful for MongoDB to look at the BSON data into human readable format directly from a WT table. Currently the process of making this work, is to use WT dump in hex format and then use the hex_to_bson.sh script on the otuput.
      The script is:

      #! /usr/bin/python
      import bson
      import sys
      import pprint
      
      while True:
          line = sys.stdin.readline()
          if not line:
              print("No data section")
              sys.exit(1)
          line = line.strip()
          if line == 'Data':
              break
      while True:
          key = sys.stdin.readline()
          if not key:
              break
          key = key.strip()
          value = sys.stdin.readline().strip()
          print('Key:\t%s' % (key,))
          byt = value.decode('hex')   
          obj = bson.decode_all(byt)[0]
          print('Value:\n\t%s' % (pprint.pformat(obj, indent=1).replace('\n', '\n\t'),))
      

      Aim:
      Create a python script that will perform both the wt dump step and converting the hex to bson format.

            Assignee:
            Monica Ng
            Reporter:
            Jie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: