►
From YouTube: Hyper Query Workshop with DENO
Description
⚡️ hyper query workshop ⚡️
In this part 3 of the "hyper data" workshop series, Tom walks through the query and bulk features of the "hyper data" service:
https://github.com/hyper63/workshops
Watch and code along by following the instructions in the repo link a above.
you can create a hyper developer account at https://hyper.io and join the hyper community at https://hyper.io/slack
Cheers! 🎉
A
A
But
you
also
need
to
do
a
little
bit
more
hypers
data
service
encourages
a
single
table,
design
architecture
where
you
put
all
your
documents
in
one
service
and
you
use
properties
like
type
and
prefixed
identifiers
to
identify
your
documents
instead
of
creating
multiple
tables
or
multiple
data
services
for
each
document
type-
and
this
works
really
well.
It
allows
you
to
query
multiple
types
together
in
a
in
effect,
creating
kind
of
a
join
kind
of
functionality,
with
the
still
the
ability
to
scale
horizontally.
A
So
with
that,
you
have
the
ability
to
do
queries
and
hyper's
data
service
uses
a
query
syntax
very
similar
to
mongodb
or
couchdb's
mango
query
syntax.
A
But
basically
it's
a
object
and
you
have
operators
like
dollar
sign,
eq
for
equals,
or
dollar
sign
gt
for
greater
than
or
dollar
sign,
or
for
or
dollar
sign,
and
for
am
things
like
that
so
to
follow
along
in
this
workshop,
you
need
to
know
about
http
json,
apis
javascript,
and
you
should
have
a
github
account
and
again
in
this
workshop,
we'll
be
using
dino
and
let's
go
ahead
and
launch
our
get
pod
environment
and
you
can
do
that
by
doing
https,
getpod.io,
pound,
https,
github.com,
hyper63
workshops
and
you
log,
in
with
your
github
account
and
you're
off
to
the
races
and
while
that
is,
is
spinning
up
we'll
go
to
the
hyper
developer,
dashboard
and
we'll
create
an
app
if
you
haven't
created
one
I'm
going
to
use
the
app
I
created
earlier
today
and
once
you
create
that
app,
then
you
want
to
grab
the
connection
string.
A
A
A
The
next
thing
we
want
to
do
in
a
terminal
and
I'm
going
to
close
this
terminal
and
this
one
and
this
one
and
then
I'm
going
to
go
to
data
query
here
and
I'm
going
to
right,
click
and
say
open
integrated
terminal
and
all
that
is,
is
a
nice
shortcut
where
it'll
open
to
the
data
query
directory
and
I'm
going
to
run.
A
A
So
we
can
use
that
document
to
kind
of
list
all
the
characters
that
are
in
a
game
or
list
all
the
games,
that
a
character
is
in
kind
of
this
mini
to
mini
relationship.
A
So
that's
super
cool
we've
done
that
now.
The
next
thing
we
need
to
do
is
start
up
our
api
server,
so
we're
just
going
to
do
scripts,
start
dot,
sh
and
just
make
sure
you're
in
data
query,
and
we
should
be
up
and
running
and
I'm
going
to
create
a
new
terminal
window
and
I'm
just
going
to
try
out
some
curl
commands
so
curl
localhost
3000
api.
A
A
A
A
A
In
our
setup
we
created
some
associations
so
that
we
could
get
started
in
our
api.
We're
going
to
create
a
new
endpoint
called
characters,
underscore
query:
when
the
developer
sends
a
post
with
the
game
id
specified,
we
will
need
to
return
all
the
characters
for
that.
So
here's
an
example:
if
we
send
post
api
characters,
underscore
query
game
id
equals
game
id1.
So
let's
go
ahead
and
write
that
out
pearl
local
host.
A
A
We
can
see
that
we
need
to
create
a
post
function
and
I
think
we
need
to
do
that
in
the
api
characters.
Query
js
file,
so
we
go
and
use
command,
p
and
say:
query
js
file
and
api
characters
right.
A
A
I
think
let's
go
to
server
data
query,
yes,
so
in
in
the
server
we're
importing
connect
and
then
we're
creating
a
little
bit
of
middleware
so
in
the
middleware
we're
creating
our
hyper
instance
and
then
we're
attaching
it
to
the
request
object
here
in
the
middleware.
So
what
that
does?
Is
that
just
every
time
we
implement
a
handler?
We
can
just
pick
the
hyper
instance
off
of
the
request
object
without
having
to
do
import
and
connect
every
single
time,
and
that
makes
our
code
cleaner
and
it
puts
our
connection.
A
Functionality
in
one
place
and
our
grab
of
the
environment
variable
in
one
place
and
just
the
overall
nicer
api
in
the
previous
workshops,
we
wanted
to
kind
of
be
explicit
to
kind
of
show
what
you're
doing
and
now
we're
leveraging
express,
middleware
or
opine
middleware
to
inject
the
hyperservice
in
to
our
handler.
So
when
this
request
comes
in
we're
going
to
have
a
couple
of
things,
we're
going
to
have
the
hyper
instance
that
we
want
to
to
grab
and
we're
going
to
have
query
params.
A
A
A
As
we
want
to
get
all
the
appearances
of
for
for
all
the
characters
that
appeared
in
this
particular
game,
so
the
the
type
would
be
appearance
and
then
the
game.
A
And
I
think
it's
dot
game
dot
id.
So
what
what
it
is
is
a
nested
object,
so
game
dot
id
will
be
equal
to
query
dot
game
id
like
that.
A
A
Oops
query
message
not
found?
Maybe
I
need
to
restart
my
server.
Maybe
it's
not
running
reload,
which
is
quite
possible.
A
A
Characters
underscore
query:
where
game
one
equals
game
one.
We
get
these
appearance
documents
and,
let's
just
pretty
find
them
or
second,
so
we
can
see
so.
Each
appearance
document
has
a
game,
property
and
a
character
property.
So
what
we
could
do
with
these
results,
if
we
just
want
to
list
the
characters,
is
just
pluck
out
the
character
property
for
each
one
of
these
docs
and
and
return
that
right
and
we
don't
even
need
to
worry
about
the
appearance
id.
We
just
can
return
the
character
and
we
have
the
name.
A
So
if
we
don't
need
any
other
data,
then
we
can
just
return
the
id
and
name
and
that
will
like
populate
a
drop
down
right
where
you
have
the
character,
id
and
name
or
populate
a
a
list.
So
let's
go
ahead
and
do
that.
A
Map
over
the
documents
and
we'll
get
a
single
doc
and
then
we'll
just
return
doc,
dot
character
like
that,
and
so
what
that
should
do
is
kind
of
pluck
out
that
character,
property
and
now
we
should
just
get
a
list
of
characters
cool.
So
in
donkey
kong
we
have
one
character.
Mario
now
I
don't
know
we
have
any
other
appearances,
but
maybe
cool
so
in
game
two.
We
have
two
characters:
mario
and
luigi,
so
that
that's
pretty
cool
and
basically
the
selector.
A
A
Now
this
is
going
to
return
two
appearance
documents,
so
it
should
show
like
mario
twice.
A
So
that's
kind
of
the
or-
and
you
could
do
like
less
than
and
greater
than
and
use
limit
for,
pagination
stuff.
You
can
do
equal,
not
equal,
there's,
all
kinds
of
operators
you
can
do
and
you
can
see
a
list
of
them
in
our
documentation.
A
Open
up
in
a
new
tab,
then
you
can
see
okay,
so
you
can
see
here's
all
the
selectors
exist
in
not
in
etc.
So
pretty
cool
one
note
is
the
reg
x
will
not
capture
any
indexes
that
are
created.
So
so
that's
going
to
always
be
a
scan.
A
It
will
scan
so
you
don't
want
to
have
a
long
list
where
you're
doing
an
n
operator
and
there's
some
other
things
to
think
about,
but
yeah,
that's
that's
it.
That's!
That's
kind
of
the
query,
interface
and-
and,
like
I
said
you
can,
you
know,
really
be
very
concise
on
what
kind
of
data
you
would
like
to
return.
A
There's
a
create
index
or
index
command
where
you
can
build
an
index
and
make
sure
that
every
time
you
query
that
it
comes
back
in
a
very
performant
way,
no
matter
how
many
records
are
in
the
data
store.
So
that's
that's!
Pretty
cool!
A
There's
other
options
like
fields.
You
can
limit
the
amount
of
fields
you
would
like
to
return.
So
in
this
case,
instead
of
using
this
map
down
here,
we
could
just
say.
A
Builds
and
then
we
provide
an
array
and
say
you
know
what
we
just
want
to
return
the
character
field
and
if
we
run
that
we
just
get
the
character
fill
it
is,
you
know,
kind
of
nested
deep
in
there,
so
you
might
want
to
still
pluck
it
out,
but
but
that's
pretty
cool
and
then
you
have
sort.
So
you
can
sort
by
properties
by
giving
an
array
of
objects
and
you
would
specify
descending
or
ascending
limit
and
use
index.
A
You
can
specify
an
index
that
you
created
to
optimize
that
so
you
may
want
to
take
a
minute,
and
you
know
now
that
we've
created
the
characters
by
game.
Id
use
the
same
kind
of
formula
to
go
to
api
games,
underscore
query
and
create
a
list
of
games
by
character
id
right
so
give
that
a
shot
and
then
bulk,
so
refactor
update
characters
game.
So,
let's
use
the
bulk
feature
to
add
more
characters
and
games,
we'll
create
a
new
file
called
bulk
js.
A
A
I'm
just
going
to
copy
it
because
that's
a
lot
of
typing
so
we'll
just
paste
that
in
and
now
we've
got
this
data
array
and
now
we
can,
you
know,
kind
of
import
hyper
and
we're
also
importing
this
dot
emv
so
that
we
can
read
the
dot
emv
file
here.
So
this
dot
env
will
read
that
in
and
now
we
can
create
this
hyper
instance.
A
And
now
we
can
just
call
hyper
data
bulk
and
what
it's
going
to
do
is
it's
going
to
essentially
add
all
of
this
data
into
our
data
store.
So
we
can
log
it
out
and
just
call
await
hyper
dot
data
bulk
data
like
that,
and
if
we
run
it,
we
want
to
use
our
import
map
json
file
so
that
it
can
understand
everything
and
then
we're
just
going
to
say.
We
approve
all
of
the
things
using
the
a
and
also
unstable,
because
we've
got
some
unstable
modules
which
work
fine.
A
But
let's
just
run
this
dino
command.
A
And
I
need
to
be
in
that
folder,
so
cd
data
query
we'll
get
there
eventually
so
now,
dino
run
and
it's
going
to
grab
the
bulk
js
file
and
boom.
It's
added
three
more
characters,
a
couple
of
games
and
an
appearance
document,
and
the
nice
thing
is.
Is
the
bulk
is
item
potent?
So
if
the
data
already
exists,
it's
just
going
to
update
it.
If
you
wanted
to
delete
data,
you
could
just
go
in
here
and
let's.
A
A
A
The
the
other
thing
with
bulk
is
is
you
can
like
remove
all
related
things
when
you
need
to
remove
something.
So
if
you
have
a
delete
function,
where
you're
deleting
a
game,
you
may
want
to
remove
all
the
appearance
documents
that
that
game
is
related
to
so
here's
some
call
code
example.
You
could
try
to
do
that
where
we're
basically
getting
the
appearances
for
game
id
and
getting
those
documents
and
then
we're
adding
the
deleted
flag,
then
we're
passing
them
to
the
bulk,
and
then
we
remove
the
game
one.
A
A
So
we
looked
at
a
couple
of
advanced
features
with
hyper
data,
and
hopefully
you
got
an
idea
of
how
to
use
those,
and
you
know
what
we'll
start
to
to
look
at
next
is
our
cash
service.
So
we
we
kind
of
covered
the
data
service
at
a
entry
level,
and
the
next
thing
we
want
to
do
is
look
at
how
we
can
leverage
the
cash
service
to
to
do
things
like
creating
hot
counters,
and
you
know
really
fast
reads
when
accessing
data
documents
so
hope.