New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mongodb-stitch

Package Overview
Dependencies
Maintainers
2
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongodb-stitch

The original source is located in `src/`. To transpile to pure JS, run `npm run build` which places the output into `dist/`.

  • 0.0.6
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

mongodb-stitch

The original source is located in src/. To transpile to pure JS, run npm run build which places the output into dist/.

Documentation

Usage

Construct a simple app-wide client:

import { StitchClient } from 'stitch';
let appId = 'sample-app-ovmyj';
let stitchClient = new StitchClient(appId);

Authenticate anonymously:

stitchClient.anonymousAuth()
  .then(() => console.log('logged in as: ' + stitchClient.auth().user._id))
  .catch(e => console.log('error: ', e));

Access MongoDB APIs:

let db = stitchClient.service('mongodb', 'mongodb1').db('app-ovmyj'); // mdb1 is the name of the mongodb service registered with the app.
let itemsCollection = db.collection('items');

// CRUD operations:
let userId = stitchClient.authedId();
itemsCollection.insertMany([ { owner_id: userId, x: 'item1' }, { owner_id: userId, x: 'item2' }, { owner_id: userId, x: 'item3' } ])
  .then(result => console.log('success: ', result))
  .catch(e => console.log('error: ', e));

Access other services:

// executePipeline takes an array of pipeline stages.
stitchClient.executePipeline([
  {
    action: 'literal',
    args: {
      items: [ { name: 'hi' }, { name: 'hello' }, { name: 'goodbye' } ]
    }
  },
  {
    action: 'match',
    args: {
      expression: { name: 'hello' }
    }
  }
])
  .then(result => console.log('success: ', result))
  .catch(e => console.log('error: ', e));;

FAQs

Package last updated on 15 Jun 2017

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc