FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix EmbJSON processing for no-match upserts by xiaolu-ai26 · Pull Request #12 · onenodehq/onenode · GitHub

Fix EmbJSON processing for no-match upserts - #12

Open
xiaolu-ai26 wants to merge 1 commit into
onenodehq:mainfrom
xiaolu-ai26:patch-1
Open

Fix EmbJSON processing for no-match upserts#12
xiaolu-ai26 wants to merge 1 commit into
onenodehq:mainfrom
xiaolu-ai26:patch-1

Conversation

Copy link
Copy Markdown

Summary

Fixes #11 by making no-match upserts run through the same EmbJSON processing path as normal updates.

Before this change, update(..., upsert=True) only called process_update(...) when doc_ids existed before the Mongo update. If the filter matched nothing, Mongo inserted the new document but xText / xImage fields were left raw:

  • no chunks were written back into xText
  • no Pinecone vector tasks were queued
  • no image embedding/upload tasks were queued
  • semantic query could not find the upserted content

Changes

  • Add a small helper to derive the upsert document ID from _id equality filters or $setOnInsert._id.
  • Generate and inject a deterministic _id into $setOnInsert when Mongo would otherwise create one implicitly.
  • Use that ID to run the existing process_update(...) path before update_many(..., upsert=True) persists the document.

Validation

  • python3 -m py_compile blueprints/v0/project/db/collection/document/services.py

Notes

This keeps existing matched-update behavior unchanged. The extra branch only runs when upsert=True and the pre-update filter finds no existing document.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upsert skips EmbJSON processing when no document matches

1 participant


Back | FazBrowse Home | New Git URL