Git Product home page Git Product logo

gatsby-source-mongodb-stitch's Introduction

MongoDB Stitch Source Plugin for Gatsby

Description

This source plugin serves as a simple wrapper for MongoDB Stitch access within Gatsby. Specifically, the plugin calls a number of supplied functions at build-time to gather nodes.

This plugin expects the result type from stitch to be an array of objects, where each object will be a node in Gatsby.

TODO: Support authentication-required applications.

Learning Resources (optional)

For help setting up a serverless architecture in MongoDB Stitch, feel free to consult the docs.

How to install

Install via your selected package manager, i.e.:

npm install gatsby-source-mongodb-stitch or yarn add gatsby-source-mongodb-stitch.

Available options

option required? description
stitchId Yes The ID of your MongoDB Stitch Application
functions Yes An array of function calls to execute via Stitch. Each element of functions is to be an object with the below properties

Functions

Each supplied function should have the following properties:

option required? description
name Yes The name of the function to call
args No An array of arguments to invoke the function name with
resultType Yes The type to use for resulting nodes
getResultId No A function to get the id for a result document (default is _id)

Examples of usage

Once installed, register the plugin by adding to plugins in gatsby-config:

{
    resolve: 'gatsby-source-mongodb-stitch',
    options: {
        stitchId: /* stitch-app-id */,
        functions: [
            {
                name: /* function-name */,
                args: [/* some-function-args */],
                resultType: /* result-node-type*/,
                getResultId: /* document => document._id (or some unique ID) */,
            },
        ],
    },
},

How to query for data (source plugins only)

You will be able to query for the type specified as the resultType for that function after the sourceNodes step is complete.

How to develop locally

  1. Clone this repository
  2. Develop on a feature branch
  3. Open a pull request with your feature branch against master

How to contribute

Feel free to leave issues or pull requests for this plugin!

gatsby-source-mongodb-stitch's People

Contributors

jestapinski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.