From 9a804983e7e656ccc54e529fc78004b0d3802208 Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Tue, 19 Nov 2024 21:36:18 -0500 Subject: [PATCH] WIP - Create document with actual docID not user provided value --- internal/db/fetcher/versioned.go | 12 ++++++++++-- .../integration/query/simple/with_cid_doc_id_test.go | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/db/fetcher/versioned.go b/internal/db/fetcher/versioned.go index bce2ed690f..37cd41625b 100644 --- a/internal/db/fetcher/versioned.go +++ b/internal/db/fetcher/versioned.go @@ -329,7 +329,11 @@ func (vf *VersionedFetcher) merge(c cid.Cid) error { mcrdt = merklecrdt.NewMerkleCompositeDAG( vf.store, keys.NewCollectionSchemaVersionKey(block.Delta.GetSchemaVersionID(), vf.col.Description().RootID), - vf.dsKey.WithFieldID(core.COMPOSITE_NAMESPACE), + keys.DataStoreKey{ + CollectionRootID: vf.col.Description().RootID, + DocID: string(block.Delta.GetDocID()), + FieldID: fmt.Sprint(core.COMPOSITE_NAMESPACE), + }, ) vf.mCRDTs[0] = mcrdt } @@ -358,7 +362,11 @@ func (vf *VersionedFetcher) merge(c cid.Cid) error { keys.NewCollectionSchemaVersionKey(block.Delta.GetSchemaVersionID(), vf.col.Description().RootID), field.Typ, field.Kind, - vf.dsKey.WithFieldID(fmt.Sprint(field.ID)), + keys.DataStoreKey{ + CollectionRootID: vf.col.Description().RootID, + DocID: string(block.Delta.GetDocID()), + FieldID: fmt.Sprint(field.ID), + }, field.Name, ) if err != nil { diff --git a/tests/integration/query/simple/with_cid_doc_id_test.go b/tests/integration/query/simple/with_cid_doc_id_test.go index 8c6476b1e5..29a630ac19 100644 --- a/tests/integration/query/simple/with_cid_doc_id_test.go +++ b/tests/integration/query/simple/with_cid_doc_id_test.go @@ -335,7 +335,7 @@ func TestCidAndDocIDQuery_ContainsPNCounterWithIntKind_NoError(t *testing.T) { Request: `query { Users ( cid: "bafyreihsqayh6zvmjrvmma3sjmrb4bkeiyy6l56nt6y2t2tm4xajkif3gu", - docID: "bae-d8cb53d4-ac5a-5c55-8306-64df633d400d" + docID: "bae-bc5464e4-26a6-5307-b516-aada0abeb089" ) { name points @@ -389,7 +389,7 @@ func TestCidAndDocIDQuery_ContainsPNCounterWithFloatKind_NoError(t *testing.T) { Request: `query { Users ( cid: "bafyreigkdjnvkpqfjoqoke3aqc3b6ibb45xjuxx5djpk7c6tart2lw3dcm", - docID: "bae-d420ebcd-023a-5800-ae2e-8ea89442318e" + docID: "bae-2c7c40a7-92c1-5ed4-8a00-9e8595514945" ) { name points