:py:mod:`flow.record.adapter.mongo` =================================== .. py:module:: flow.record.adapter.mongo Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: flow.record.adapter.mongo.MongoWriter flow.record.adapter.mongo.MongoReader Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: flow.record.adapter.mongo.parse_path Attributes ~~~~~~~~~~ .. autoapisummary:: flow.record.adapter.mongo.__usage__ .. py:data:: __usage__ :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ MongoDB adapter --- Write usage: rdump -w mongo://[IP]:[PORT]/[DBNAME]/[COLLECTION] Read usage: rdump mongo://[IP]:[PORT]/[DBNAME]/[COLLECTION] [IP]:[PORT]: ip and port to a mongodb instance [DBNAME]: database name to write to or read from [COLLECTION]: collection to write to or read from """ .. raw:: html
.. py:function:: parse_path(path: str) -> tuple[str, str, str] .. py:class:: MongoWriter(path: str, key: str | None = None, **kwargs) Bases: :py:obj:`flow.record.adapter.AbstractWriter` .. py:attribute:: client :value: None .. py:attribute:: key :value: None .. py:attribute:: db .. py:attribute:: collection .. py:attribute:: coll_descriptors .. py:attribute:: descriptors .. py:method:: write(r: flow.record.base.Record) -> None Write a record. .. py:method:: flush() -> None Flush any buffered writes. .. py:method:: close() -> None Close the Writer, no more writes will be possible. .. py:class:: MongoReader(path: str, selector: str | None = None, **kwargs) Bases: :py:obj:`flow.record.adapter.AbstractReader` .. py:attribute:: client :value: None .. py:attribute:: selector :value: None .. py:attribute:: db .. py:attribute:: collection .. py:attribute:: coll_descriptors .. py:attribute:: descriptors .. py:method:: close() -> None Close the Reader, can be overriden to properly free resources. .. py:method:: __iter__() -> collections.abc.Iterator[flow.record.base.Record] Return a record iterator.