# Type alias Get

Get: (<N>(collectionName, id, document) => Process<Resources.Resource<N> | undefined>)

#### Type declaration

- - <N>(collectionName, id, document): Process<Resources.Resource<N> | undefined>

  - `resources.get`

    Retrieves full or partial representations of a resource given its ID. Parameter `document` is a GraphQL DocumentNode that defines a fragment on the resource object type, to control which fields are returned.

    Note: This function returns a generator. For `async` behavior, use with a [[Meta.Process.ProcessorRunner | ProcessorRunner]] such as that returned by [[Run.forDb]] or [[Project.run]].

    #### Type Parameters

    - #### N extends Resources.CollectionName

    #### Parameters

    - ##### collectionName: N

    - ##### id: string

    - ##### document: graphql.DocumentNode

    #### Returns Process<Resources.Resource<N> | undefined>

    #### Example

        import gql from "graphql-tag";
        import { connect, Process } from "@truffle/db";

        const db = connect({
          // ...
        });

        const { Run, resources } = Process;

        const { run } = Run.forDb(db);

        const { contents } = await run(resources.get, "sources", "0x...", gql`
          fragment Contents on Source {
            contents
          }
        `);

- Defined in packages/db/src/process.ts:154

Generated using TypeDoc