diff --git a/src/aind_data_access_api/document_db.py b/src/aind_data_access_api/document_db.py index 8691eca..d6b68ed 100644 --- a/src/aind_data_access_api/document_db.py +++ b/src/aind_data_access_api/document_db.py @@ -429,8 +429,6 @@ def aggregate_docdb_records(self, pipeline: List[dict]) -> List[dict]: def insert_one_docdb_record(self, record: dict) -> Response: """Insert one new record""" - if record.get("_id") is None: - raise ValueError("Record does not have an _id field.") response = self._insert_one_record( json.loads(json.dumps(record, default=str)), ) diff --git a/tests/test_document_db.py b/tests/test_document_db.py index 6a11ea2..d4be5a7 100644 --- a/tests/test_document_db.py +++ b/tests/test_document_db.py @@ -579,24 +579,6 @@ def test_insert_one_docdb_record(self, mock_insert: MagicMock): json.loads(json.dumps(record, default=str)), ) - @patch("aind_data_access_api.document_db.Client._insert_one_record") - def test_insert_one_docdb_record_invalid(self, mock_insert: MagicMock): - """Tests inserting one docdb record if record is invalid""" - client = MetadataDbClient(**self.example_client_args) - record_no__id = { - "id": "abc-123", - "name": "modal_00000_2000-10-10_10-10-10", - "created": datetime(2000, 10, 10, 10, 10, 10), - "location": "some_url", - "subject": {"subject_id": "00000", "sex": "Female"}, - } - with self.assertRaises(ValueError) as e: - client.insert_one_docdb_record(record_no__id) - self.assertEqual( - "Record does not have an _id field.", str(e.exception) - ) - mock_insert.assert_not_called() - @patch("aind_data_access_api.document_db.Client._upsert_one_record") def test_upsert_one_docdb_record(self, mock_upsert: MagicMock): """Tests upserting one docdb record"""