Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Functions

all

  • all<Model>(collection: Collection<Model>): Promise<Doc<Model>[]>
  • Returns all documents in a collection.

    import { all, collection } from 'typesaurus'
    
    type User = { name: string }
    const users = collection<User>('users')
    
    all(users).then(allUsers => {
      console.log(allUsers.length)
      //=> 420
      console.log(allUsers[0].ref.id)
      //=> '00sHm46UWKObv2W7XK9e'
      console.log(allUsers[0].data)
      //=> { name: 'Sasha' }
    })

    Type parameters

    • Model

    Parameters

    • collection: Collection<Model>

      The collection to get all documents from

    Returns Promise<Doc<Model>[]>

    A promise to all documents

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc