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[source]

Execute query within MongoDB database.

Parameters:
  • 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

Returns:

A ServiceResponse object that contains execution results or error message.

Return type:

ServiceResponse

Note

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.