diff --git a/db/document.go b/db/document.go index f8bb4b75..63441ce2 100644 --- a/db/document.go +++ b/db/document.go @@ -236,8 +236,9 @@ func (d *document) setup(ctx context.Context) (err error) { // maniuplate the virtual document. if d.doc != nil { - d.initial = d.doc - d.current = d.doc.Copy() + enc := d.doc.Encode() + d.initial = data.New().Decode(enc) + d.current = data.New().Decode(enc) } // The requested record has been loaded diff --git a/util/data/data.go b/util/data/data.go index 81a5fe7a..b4d07ea7 100644 --- a/util/data/data.go +++ b/util/data/data.go @@ -22,7 +22,6 @@ import ( "encoding/json" - "github.com/abcum/surreal/util/deep" "github.com/abcum/surreal/util/pack" ) @@ -67,7 +66,7 @@ func (d *Doc) Data() interface{} { // Copy returns a duplicated copy of the internal data object. func (d *Doc) Copy() *Doc { - return &Doc{data: deep.Copy(d.data)} + return new(Doc).Decode(d.Encode()) } // Encode encodes the data object to a byte slice.