Download Word narrative

Tre Olson | CS 499 Computer Science Capstone
Milestone Four | October 4, 2026

Artifact and purpose

My database artifact is the AnimalShelter CRUD Python module from CS 340, originally created during that course for the Austin Animal Center and Grazioso Salvare project before this capstone. The module connects to MongoDB and supports creating, reading, updating, and deleting animal records. Its read method converts every matching record into a Python list. That behavior is convenient for small examples but gives callers no pagination or projection controls and can transfer more data than they need.

For Milestone Four, the enhanced artifact adds controlled search, bounded pagination, selected fields, rescue aggregation, and a compound index with an explain based evaluation. It builds on my Milestone Two layered package while making a distinct database enhancement. The submission preserves the original CRUD source and includes the enhanced package, automated tests, and actual verification output.

Why I selected this artifact

I selected this module because it connects database decisions to a practical application: identifying animal records that match configured rescue criteria. The enhancement demonstrates query design, database side analysis, performance evaluation, and validation at the application boundary. These skills are relevant to my interest in backend and full stack software development.

The new search API allows approved equality filters, age bounds, sorting, field selection, and rescue categories. It retrieves at most the requested page size plus one record to determine whether another page exists. A unique MongoDB identifier breaks sort ties. The aggregation pipeline matches records, groups them by breed and rescue category, sorts the counts, and limits the returned groups. This supplies useful summaries without transferring all matching records to Python.

Course outcomes and plan updates

The enhancement provides evidence for the Module One database goals in Outcomes 3, 4, and 5. Outcome 3 is supported by selecting an index for the rescue filter workload, evaluating its effect, and documenting trade offs. Indexes consume storage and require maintenance during writes. Offset pagination bounds returned data but still becomes more expensive as page depth increases. Stable ordering prevents ambiguous ties; it does not make separate page requests a consistent snapshot when records change.

Outcome 4 is supported by implementing MongoDB search, projection, aggregation, and execution statistics inspection with PyMongo. The live checks verify exact results, summary counts, pagination, age boundaries, and overlapping rescue categories. Outcome 5 is supported by rejecting raw query operators, nested filter documents, unsupported fields, invalid sort directions, and oversized pages before database access. The inherited configuration keeps credentials outside source code, and controlled exceptions avoid exposing driver details. Deployment should separate read only access from index administration; the package does not itself configure server roles or enforce an application authorization system.

I retained the planned database capabilities with two implementation adjustments. Invalid page sizes are rejected rather than silently clamped so callers receive clear feedback. Index creation is an explicit deployment step rather than part of every service startup, allowing read-only queries to run without index management privileges. The narrative and README also support Outcome 2 through technical communication. The final portfolio review guide supports Outcome 1 with documented review strategies and decisions. This was individual coursework; no external team review is claimed.

Verification and measured results

The complete offline suite passed 45 tests, including 31 inherited tests and 14 new database tests, and all 45 passed again during final verification on October 18, 2026. The retained Milestone Four live verification ran against MongoDB 8.0.16 with PyMongo 4.18.1. It used 10,000 generated records, including 100 matching water rescue candidates, in an isolated collection. Before index creation, the collection had only its default identifier index. The same ordered candidate records were returned before and after the new index. The live server experiment was not repeated during final packaging.

Execution statistic Before index After index
Records returned 100 100
Documents examined 10,000 100
Index keys examined 0 100
Time reported in milliseconds 2 0

Reflection on the enhancement process

The main lesson from this enhancement is that database performance should be evaluated together with correctness. In the generated workload, the unhinted plan changed from a collection scan to an index scan, with 99 percent fewer documents examined. Forced natural-scan and index hint controls produced consistent evidence. The zero millisecond reading is a rounded measurement, not instantaneous execution. MongoDB explain also bypasses the plan cache, so these results do not establish production latency or guarantee equivalent gains on the real AAC dataset (MongoDB, n.d.-b).

One design challenge was adding flexible search while keeping user input controlled. I addressed it by building MongoDB expressions from validated scalar options rather than accepting arbitrary query documents. Combining filters with logical intersection prevents a category preset from overwriting a caller’s additional constraint. Another challenge was defining rescue-summary behavior when breeds qualify for multiple categories. Without an explicit category, the implementation assigns water, then mountain, then disaster precedence; an explicit category uses that category’s own rules. This makes counts interpretable and avoids accidentally counting each animal more than once in the default report.

The verification also shows why database aware tests matter. Mocked adapter tests check validation, cursor cleanup, time limits, and controlled failures, but cannot establish that MongoDB executes a pipeline correctly. The live checks verify actual server aggregation and page behavior. Future improvements include testing representative AAC records and query distributions, validating deployment permissions, and replacing deep offset pages with cursor based pagination. MongoDB documents that skip based paging requires scanning past earlier results and slows as the offset grows (MongoDB, n.d.-c).

The work demonstrates the planned database skills with runnable code and reproducible evidence. The final ePortfolio presents this database enhancement separately from the earlier software architecture enhancement and links both to the unchanged CS 340 source. Representative AAC workloads, deployment permission checks, and reviewer feedback will guide future revisions.

References

MongoDB. (n.d.-a). Compound indexes. https://www.mongodb.com/docs/manual/core/indexes/index-types/index-compound/

MongoDB. (n.d.-b). explain database command. https://www.mongodb.com/docs/manual/reference/command/explain/

MongoDB. (n.d.-c). cursor.skip. https://www.mongodb.com/docs/manual/reference/method/cursor.skip/

Acknowledgment