Skip to main content

MongoDB aggregate operations declared for python

Project description

PyMongoAggregate

version: "0.0.1"

example

from re import compile as re_compile

from pymongo_aggregate.operations.stages.match import Match
from pymongo_aggregate.operations.stages.project import Project
from pymongo_aggregate.operations.stages.unwind import Unwind
from pymongo_aggregate.operations.operators.regex_find import RegexFind


pipeline = [
    Match({
        "experiment_name": "experiment2"
    }),
    Project({
        "proxy_id": 1,
        "input_text": 1,
        "capture_country": RegexFind(input_field="$output", pattern=re_compile(r"\*\*Country\*\*\n\s+-\s+(.*)\n"))
    }),
    Unwind(
        path="$capture_country.captures",
        include_array_index="country_index",
        preserve_null_and_empty_arrays=True
    ),
    Match({
        "country_index": 0
    }),
    Project({
        "_id": 0,
        "proxy_id": 1,
        "input_text": 1,
        "output_country": "$capture_country.captures"
    })
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymongo_aggregate-0.0.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymongo_aggregate-0.0.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file pymongo_aggregate-0.0.1.tar.gz.

File metadata

  • Download URL: pymongo_aggregate-0.0.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pymongo_aggregate-0.0.1.tar.gz
Algorithm Hash digest
SHA256 64d563437ddb3b184dbaa5e4e1e350ca2551641bd0a534f3583e7632e12fd566
MD5 fdf0de9c22c59da2e7e191c60c7a5818
BLAKE2b-256 7f00be24a263f32dab813638d2628f74c5d576de4880d81856d89f9343da7879

See more details on using hashes here.

File details

Details for the file pymongo_aggregate-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pymongo_aggregate-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed4e5bad2e64ce3954d6475b99e584a72b8b37450d9fbba101c755683fda4b7e
MD5 34d93ed339264c33325ab5ec2b0b20fb
BLAKE2b-256 0a3c9501e2e577d85c03dbcc5edf585e111d0422230312167f4f18b3029edaa9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page