Exemple #1
0
def get_doc_size(doc):
    """
    Get document size in bytes

    :Parameters:
        - `doc`: string or dict

    """
    if not isinstance(doc, dict):
        doc = json.loads(doc)

    return len(BSON.encode(doc))
Exemple #2
0
def get_doc_size(doc):
    """
    Get document size in bytes

    :Parameters:
        - `doc`: string or dict

    """
    if not isinstance(doc, dict):
        doc = json.loads(doc)

    return len(BSON.encode(doc))
Exemple #3
0
 def test_data_serialization(self, data):
     self.load_bson()
     BSON.encode(data, check_keys=True)
Exemple #4
0
 def serialize_report(self, output_file, report_data):
     self.load_bson()
     bson_data = BSON.encode(report_data, check_keys=True)
     with open(output_file, "wb") as fp:
         fp.write(bson_data)
Exemple #5
0
 def test_data_serialization(self, data):
     self.load_bson()
     BSON.encode(data, check_keys=True)
Exemple #6
0
 def serialize_report(self, output_file, report_data):
     self.load_bson()
     bson_data = BSON.encode(report_data, check_keys=True)
     with open(output_file, "wb") as fp:
         fp.write(bson_data)