agentscope.service.sql_query.mongodb module

query in MongoDB

agentscope.service.sql_query.mongodb.query_mongodb(database: str, collection: str, query: dict, host: str, port: int, maxcount_results: int | None = None, **kwargs: Any) ServiceResponse[源代码]

Execute query within MongoDB database.

参数:
  • database (str) – The name of the database to use.

  • collection (str) – The name of the collection to use in mongodb.

  • query (dict) – The mongodb query to execute.

  • host (str) – The hostname or IP address of the MongoDB server.

  • port (int) – The port number of MongoDB server.

  • maxcount_results (int, defaults to None) – The maximum number of results to return. Defaults to 100 to avoid too many results.

  • **kwargs

返回:

A ServiceResponse object that contains execution results or error message.

返回类型:

ServiceResponse

备注

MongoDB is a little different from mysql and sqlite, for its operations corresponds to different functions. Now we only support find query and leave other operations in the future.