sourcenetwork / defradb

DefraDB is a Peer-to-Peer Edge Database. It's the core data storage system for the Source Network Ecosystem, built with IPLD, LibP2P, CRDTs, and Semantic open web properties.
399 stars 40 forks source link

Getting Started doc broken on create a document #2977

Closed crystal-koii closed 6 days ago

crystal-koii commented 1 week ago

Describe the problem _key doesn't exist on schema so it throws error:

defradb client query '
  mutation {
      create_User(input: {age: 31, verified: true, points: 90, name: "Bob"}) {
          _key             
      }
  }
> '
------ Request Results ------
{
  "data": null,
  "errors": [
    "Cannot query field \"_key\" on type \"User\"."
  ]
}

To Reproduce Follow getting started https://docs.source.network/defradb

Expected behavior

{
  "data": [
    {
      "_key": "bae-91171025-ed21-50e3-b0dc-e31bccdfa1ab",
    }
  ]
}

**Solution*** Update docs to return something that actually exists:

defradb client query '
mutation {
    create_User(input: {age: 31, verified: true, points: 90, name: "Bob"}) {
        _docID
    }
}
'
------ Request Results ------
{
  "data": {
    "create_User": [
      {
        "_docID": "bae-36fb9a9a-7af6-50cc-bc43-82e4c742a53e"
      }
    ]
  },
  "errors": null
}

NOTE: Also need to update everywhere else _key is used, it seems like _key has been replaced with _docID

fredcarle commented 1 week ago

Thanks for opening the issue @crystal-koii. We do indeed need to update the docs to reflect the change from _key to _docID. The docs content is located within this repo. Was it your intention to make the changes yourself and open a PR for it?