input: Write a Python function to connect to a MongoDB database and execute a query to find all documents in a given collection.
  assert query_mongodb('test_db', 'test_collection', {}) == [{'_id': 1, 'name': 'Alice'}, {'_id': 2, 'name': 'Bob'}]
  assert query_mongodb('test_db', 'test_collection', {'name': 'Alice'}) == [{'_id': 1, 'name': 'Alice'}]
  assert query_mongodb('test_db', 'test_collection', {'_id': 3}) == []
output: from pymongo import MongoClient
  
  def query_mongodb(db_name, collection_name, query):
      client = MongoClient()
      db = client[db_name]
      collection = db[collection_name]
      results = list(collection.find(query))
      client.close()
      return results