Dagger
Search

filterForNewTransactions

This module is specifically designed to interface with MongoDB to filter new transactional data from a given spreadsheet against the existing records in the database. It aims to identify and isolate transactions that have not yet been recorded in the MongoDB collection. This functionality is crucial for applications that require up-to-date transactional data without duplicates, such as financial tracking systems, expense management applications, or any system needing reconciliation between reported and recorded transactions.

The module provides functions to authenticate to MongoDB and to filter new transactions based on their unique identifiers. These functions can be called via the dagger CLI or programmatically through one of the supported SDKs.

Functions: - `authenticate`: This utility function establishes a connection to a specified MongoDB collection using provided credentials and returns a reference to the collection. It is not directly callable via the CLI but is used internally by other functions. - `filter`: This is the primary function of the module. It accepts transaction data as a JSON string along with MongoDB connection details, and filters out transactions that are already present in the database.

Args: - `data (str)`: A JSON string representing an array of transactions. Each transaction should be a dictionary containing at least a 'Transaction ID'. - `connection (Secret)`: A Secret object containing the MongoDB connection string. This should have sufficient privileges to access the specified database and collection. - `database (str)`: The name of the MongoDB database to connect to. - `collection (str)`: The name of the MongoDB collection within the specified database where transaction records are stored.

Return: - The `filter` function returns a JSON string representing an array of transactions that are new to the database (i.e., their 'Transaction ID's are not found in the existing records).

Example Call: `dagger call filter --data=[DATA] --connection=env:[KEY] --database=[DBNAME] --collection=[COLLECTIONNAME]

Installation

dagger install github.com/EmmS21/daggerverse/filterForNewTransactions@v0.0.1

Entrypoint

Return Type
FilterForNewTransactions !
Example
dagger -m github.com/EmmS21/daggerverse/filterForNewTransactions@e5eff435ad33131fd519b518f6826d5672d08c2e call \
func (m *myModule) example() *FilterForNewTransactions  {
	return dag.
			FilterForNewTransactions()
}
@function
def example() -> dag.FilterForNewTransactions:
	return (
		dag.filter_for_new_transactions()
	)
@func()
example(): FilterForNewTransactions {
	return dag
		.filterForNewTransactions()
}

Types

FilterForNewTransactions 🔗

filter() 🔗

Filters out transactions that are already in the database.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
dataString !-No description provided
connectionSecret !-A reference to a secret value, which can be handled more safely than the value itself.
databaseString !-No description provided
collectionString !-No description provided
Example
dagger -m github.com/EmmS21/daggerverse/filterForNewTransactions@e5eff435ad33131fd519b518f6826d5672d08c2e call \
 filter --data string --connection env:MYSECRET --database string --collection string
func (m *myModule) example(ctx context.Context, data string, connection *Secret, database string, collection string) string  {
	return dag.
			FilterForNewTransactions().
			Filter(ctx, data, connection, database, collection)
}
@function
async def example(data: str, connection: dagger.Secret, database: str, collection: str) -> str:
	return await (
		dag.filter_for_new_transactions()
		.filter(data, connection, database, collection)
	)
@func()
async example(data: string, connection: Secret, database: string, collection: string): Promise<string> {
	return dag
		.filterForNewTransactions()
		.filter(data, connection, database, collection)
}