def item2doc(item): port_codename = JsonTool.down(item, ["_id", cls.Field.PORT]) tradegood_codename = JsonTool.down(item, ["_id", cls.Field.TRADEGOOD]) price = merge_dicts([DictTool.keys2filtered(item, fields_others, ), {cls.Field.PORT: port_codename, cls.Field.TRADEGOOD: tradegood_codename, }, ], vwrite=vwrite_no_duplicate_key ) return price
def doc2pair(doc): doc_filter = DictTool.keys2filtered(doc, [Chatroom.Field.CODENAME]) return (doc_filter, doc)
def doc2pair(doc): doc_filter = DictTool.keys2filtered(doc, [cls.Field.CODENAME]) return doc_filter, doc