class_docstr: Calls to :meth:`orion.core.io.database.AbstractDB.read_and_write`.
docstr: Should update only one entry.
docstr_tok: ["Should","update","only","one","entry","."]
code: def test_read_and_write_many(self, orion_db, test_collection):
      """Should update only one entry."""
      documents = orion_db.read(
          "test_collection", {"same_field": "same"}
      )
      assert len(documents) > 1
  
      # Find many and update first one only
      loaded_config = orion_db.read_and_write(
          "test_collection",
          {"same_field": "same"},
          {"unique_field": "lalala"},
      )
  
      test_collection[0]["unique_field"] = "lalala"
      assert loaded_config == test_collection[0]
  
      # Make sure it only changed the first document found
      documents = orion_db.read(
          "test_collection", {"same_field": "same"}
      )
      assert documents[0]["unique_field"] == "lalala"
      assert documents[1]["unique_field"] != "lalala"
  
imports: import pickle
  from datetime import datetime
  import pytest
  from orion.core.io.database import Database, DatabaseError, DuplicateKeyError
  from orion.core.io.database.ephemeraldb import EphemeralDB
  from orion.core.io.database.mongodb import MongoDB
  from orion.core.io.database.pickleddb import PickledDB
  from .conftest import insert_test_collection
label_desc: Use image node_id 2 for calling the TestReadAndWrite obj's underlying member method code with example usage: obj.test_read_and_write_many(orion_db, test_collection) without return types