dehaze

Simple Queries

Table of Contents

You can fetch a single or multiple objects of the same type using a simple object query.

Fetch list of objects

Example: Let’s say we want to fetch a list of all pokemons. This is how you would do it:

query {
  pokemons @mongo {
    _id
    name
  }
}
// Select clause describes which fields to retrieve
const selectClause = { _id: 1, name: 1 }

const { status, data } = await db.get("pokemons").select(selectClause).apply()
console.log("Pokemons", data.result)

// To get all the fields in pokemons don't use the select clause:
// const { status, data } = db.get("pokemons").apply()

Have a technical question?

Improve the docs!