Socket
Book a DemoInstallSign in
Socket

@tigrisdata/astro

Package Overview
Dependencies
Maintainers
9
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tigrisdata/astro

An Astro integration that enables accessing a Tigris NoSQL database

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
3
50%
Maintainers
9
Weekly downloads
 
Created
Source

Tigris Astro Integration

GitHub Workflow Status npm Twitter Follow Discord

💡 What is Tigris?

If you are first-time user of Tigris, read the Getting Started guide to cover the basics.

🔨 Installation

Install @tigrisdata/astro:

npm install @tigrisdata/astro
# yarn add @tigrisdata/astro

Add the following code to astro.config.mjs and replace the YOUR_TIGRIS_PROJECT_NAME, YOUR_TIGRIS_CLIENT_ID, and YOUR_TIGRIS_CLIENT_SECRET with the values from your Tigris project.

import { defineConfig } from "astro/config";
import tigris from "@tigrisdata/astro";

export default defineConfig({
  integrations: [
    tigris({
      branch: "main",
      projectName: "YOUR_TIGRIS_PROJECT_NAME",
      clientId: "YOUR_TIGRIS_CLIENT_ID",
      clientSecret: "YOUR_TIGRIS_CLIENT_SECRET",
    }),
  ],
});

Options

When you initialize the integration, you can pass all @tigrisdata/core options.

🚀 Getting Started

Tigris collections are available with the useTigrisCollection hook:

import { useTigrisCollection } from "@tigrisdata/astro";

Fetching All Documents

You can fetch (and filter) all documents from a collection using the findMany method:

---
import { useTigrisCollection } from "@tigrisdata/astro";
import { User } from "./types/User";

const userCollection = await useTigrisCollection<User>("users");
const usersCursor = await userCollection.findMany({});
const users = await usersCursor.toArray();
---

{users.map(user =>
<div>{user.name}</div>
)}

Fetching One Document

You can fetch one document from a collection using the findOne method:

---
import { useTigrisCollection } from "@tigrisdata/astro";
import { User } from "./types/User";

const userCollection = await useTigrisCollection<User>("users");
const user = await userCollection.findOne({
    filter: {
        id: "1234"
    }
});
---

<div>{user.name}</div>

👀 Want to learn more?

Feel free to check our documentation or jump into our Discord server.

Keywords

astro

FAQs

Package last updated on 13 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.