Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

UpdateRecord drops existing edges? #44

Open
josebalius opened this issue Oct 28, 2015 · 3 comments
Open

UpdateRecord drops existing edges? #44

josebalius opened this issue Oct 28, 2015 · 3 comments

Comments

@josebalius
Copy link

So I was able to get UpdateRecord working but I started to run into a bug that took me a while to find.

Essentially I would create a record, attach some edges to it, and later on at some point I am using UpdateRecord to update it with some of the fields, but then I started to notice that all edges attached to that record were disappearing, and the queries that were expecting those edges to exist started to fail.

I can work on putting a test case together but have you run into this?

@dennwc
Copy link
Collaborator

dennwc commented Oct 28, 2015

UpdateRecord is a low level function. It will just replace the whole record with you data. It also means, that if you'll try to update record using struct without a certain field, it will just disappear. In fact, Orient stores all the links to edges in a specific field. I believe, that you have wiped it with an update)
You must first load an original Document, load struct into it, and then update the record.

@dennwc
Copy link
Collaborator

dennwc commented Oct 28, 2015

We definitely need an example for this case. It is not obvious at all. Linking to #31.

@josebalius
Copy link
Author

@dennwc I'll work on a concrete example for this, but we need to document for sure that if you are not adding fields to your struct to map whatever edges your record might have, they will be lost when using UpdateRecord

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants