TagMyTransaction
JSON & MongoDB Data Structure
Details on JSON import/export format and how data is stored in MongoDB for TagMyTransaction.

JSON Import/Export Structure (Current - v3.1+ Tagging & Visibility)

This section describes the structure for JSON files used when importing or exporting transaction data via the application's UI.

  • id: string

    A client-side unique identifier for the transaction. If importing data that doesn't have this, the app will attempt to generate one.

  • _id: string (optional)

    The MongoDB ObjectId string. This is primarily used by the database and will be present if the data originated from MongoDB.

  • date, narration, valueDate, etc.: Standard transaction fields as strings or numbers.
  • tag: string (optional)

    The primary tag for the transaction (e.g., "Groceries").

  • parentTag: string (optional)

    The parent or category tag for the transaction (e.g., "Household Expenses").

  • isManuallyTagged: boolean (optional, defaults to false)

    Set to true if the tag or parentTag were set/edited manually, preventing override by narration group rules.

  • businessKey: string (optional on import, auto-generated if missing)

    A unique key for de-duplication and syncing.

  • source: "db" | "csv" | "json" (optional on import)
  • isModified: boolean (optional on import)

Example Transaction JSON Object (Current)

{
  "id": "client_unique_id_123",
  "_id": "mongodb_object_id_string (optional, added by DB)",
  "date": "01-Jan-2023",
  "narration": "UPI-TRANSFER-XYZ-AMAZON SHOPPING",
  "valueDate": "01-Jan-2023",
  "debitAmount": 1500,
  "creditAmount": null,
  "chqRefNumber": "CHQ12345",
  "closingBalance": 12345.67,
  "tag": "Shopping",
  "parentTag": "Expenses",
  "isManuallyTagged": true,
  "businessKey": "01-jan-2023|upi-transfer-xyz-amazon shopping|d1500.00|c0.00 (auto-generated, case-insensitive)",
  "source": "csv",
  "isModified": true
}

Important Notes for JSON Import

  • The JSON file should contain a single array of transaction objects.
  • The tag, parentTag, and isManuallyTagged fields are optional.
  • The app uses the businessKey for de-duplication.

Tagging System Changelog

Current System (v3.1+): Single Tag & Parent Tag with Narration Group Rule Override (Debit/Credit specific) + Rule Visibility

  • tag: string (optional) - The primary tag.
  • parentTag: string (optional) - A secondary/category tag.
  • isManuallyTagged: boolean (optional) - If true, group rules won't override these tags.
  • Narration Group Rules (stored separately in DB) can auto-apply tag and parentTag based on narration prefixes. These rules can specify different tags for debit vs. credit transactions matching the same prefix. Rules also have an isHidden flag.

Previous System (v3.0): Single Tag & Parent Tag with Narration Group Rule Override (Debit/Credit specific)

  • tag: string (optional) - The primary tag.
  • parentTag: string (optional) - A secondary/category tag.
  • isManuallyTagged: boolean (optional) - If true, group rules won't override these tags.
  • Narration Group Rules (stored separately in DB) could auto-apply tag and parentTag based on narration prefixes, specific to debit/credit.

Previous System (v2.0): Single Tag & Parent Tag with Override (No Debit/Credit specific group rules)

  • tag: string (optional)
  • parentTag: string (optional)
  • isManuallyTagged: boolean (optional)
  • Narration Group Rules applied a single groupTag and groupParentTag to all matching transactions.

Original System (v1.0): Group Tags & Manual Tags (Arrays)

  • groupTags: string[] - Applied via narration prefix grouping.
  • manualTags: string[] - Applied individually to transactions.
{
  "groupTags": [
    "UPI",
    "Amazon"
  ],
  "manualTags": [
    "Electronics"
  ]
}

JSON files exported from older systems may not be directly compatible. Manual transformation or re-tagging might be needed if importing very old JSON data.


Accessing Data Directly from MongoDB

If you have connected TagMyTransaction to a MongoDB instance, data is stored in the following collections:

Transactions Data

  • Collection Name: TagMyTransaction
  • Structure: Each document largely mirrors the JSON structure above. Key fields include:
    • date, narration, etc.
    • tag (string, optional)
    • parentTag (string, optional)
    • isManuallyTagged (boolean, defaults to false)
    • businessKey (string)

Application Settings

  • Collection Name: app_settings
  • Structure: Typically a single document.
    • configId: "main_app_config"
    • appName: "tagMyTransaction"
    • groupingNValue: number (e.g., 5)
    {
      "_id": "mongodb_object_id_string (auto-generated by DB)",
      "configId": "main_app_config",
      "appName": "tagMyTransaction",
      "groupingNValue": 5
    }

Narration Group Rules

  • Collection Name: narration_group_rules
  • Structure: Each document defines a rule for a narration prefix, with potentially different tags for debits and credits.
    • prefix: string (the narration prefix)
    • debitGroupTag: string (optional primary tag for debits)
    • debitGroupParentTag: string (optional parent tag for debits)
    • creditGroupTag: string (optional primary tag for credits)
    • creditGroupParentTag: string (optional parent tag for credits)
    • isHidden: boolean (optional, defaults to false; if true, rule is not auto-applied and hidden by default in UI)
    {
      "_id": "mongodb_object_id_string (auto-generated by DB)",
      "prefix": "upi-transfer-xyz-",
      "debitGroupTag": "Online Payments (Debit)",
      "debitGroupParentTag": "Financial Debits",
      "creditGroupTag": "Refunds (Credit)",
      "creditGroupParentTag": "Financial Credits",
      "isHidden": false
    }

Refer to this structure when preparing your JSON files for import, examining exported data, or accessing data directly in MongoDB.