1

I have created an author user in surreal DB like this:

CREATE author:shivam SET
    name.first = 'Shivam',
    name.last = 'Sahil',
    name.full = string::join(' ', name.first, name.last),
    age = 23,
    admin = true,
    signup_at = time::now()
;

Now I want to query all the authors, but when I do:

SELECT * FROM author;

I get 0 results.

Is it supposed to be queried in some other way?

kissu
  • 40,416
  • 14
  • 65
  • 133
Shivam Sahil
  • 4,055
  • 3
  • 31
  • 62

1 Answers1

2

What you did should work well as you can see here

enter image description here

Don't forget to start your server with something like this for example

surreal start --log info --user root --pass root memory

and log-in as in my above screenshot with:

surreal sql --conn http://localhost:8000 --ns yoloswag --db compabie

Then, your create query and select should work well!


Alternatively, you can give a try to that video or documentation's quick start.


Creating another author like this is properly fetched afterwards.

CREATE author:123 SET
    name.first = 'bob',
    name.last = 'hoh',
    name.full = string::join(' ', name.first, name.last),
    age = 30,
    admin = false,
    signup_at = time::now()
;

Don't forget that 123 is supposed to be a unique ID (a string should be fine tho).

kissu
  • 40,416
  • 14
  • 65
  • 133