CipherStash
CipherStash Documentation

Get Multiple Records

The getAll API can be used to retrieve multiple records by their IDs.

import { Stash } from "@cipherstash/stashjs";

interface Movie {
  id?: string;
  title: string;
  runningTime: number;
  year: number;
}

const createAndGetAllMovies = async () => {
  const stash = await Stash.connect();
  const movies = await stash.loadCollection<Movie>("movies");

  const firstId = await movies.put({
    title: "CipherStash",
    runningTime: 60,
    year: 2020,
  });

  const id = await movies.put({
    title: "CipherStash Reloaded",
    runningTime: 60,
    year: 2020,
  });

  // Delete the newly created CipherStash II movie
  const [ first, second ] = await movies.getAll([
    firstId,
    secondId
  ]);
};

createAndGetAllMovies();