删除 Args: coll_name: 集合名 condition: 查找条件 Returns: True / False
(self, coll_name, condition: Dict)
| 399 | return 0 |
| 400 | |
| 401 | def delete(self, coll_name, condition: Dict) -> bool: |
| 402 | """ |
| 403 | 删除 |
| 404 | Args: |
| 405 | coll_name: 集合名 |
| 406 | condition: 查找条件 |
| 407 | Returns: True / False |
| 408 | |
| 409 | """ |
| 410 | try: |
| 411 | collection = self.get_collection(coll_name) |
| 412 | collection.delete_one(condition) |
| 413 | except Exception as e: |
| 414 | log.error( |
| 415 | """ |
| 416 | error:{} |
| 417 | condition: {} |
| 418 | """.format( |
| 419 | e, condition |
| 420 | ) |
| 421 | ) |
| 422 | return False |
| 423 | else: |
| 424 | return True |
| 425 | |
| 426 | def run_command(self, command: Dict): |
| 427 | """ |
nothing calls this directly
no test coverage detected