mongodb-stitch

[![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The browser SDK has moved to mongodb-stitch-browser-sdk, and the Node.js SDK has moved to mongodb-stitch-server-sdk
Last updated 8 months ago by edaniels .
Apache-2.0 · Original npm · Tarball · package.json
$ cnpm install mongodb-stitch 
SYNC missed versions from official npm registry.

mongodb-stitch

Join the chat at https://gitter.im/mongodb/stitch

MongoDB Stitch Users - Google Group

MongoDB Stitch Announcements - Google Group

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 { StitchClientFactory } from 'mongodb-stitch';
let appId = 'sample-app-ovmyj';
let stitchClientPromise = StitchClientFactory.create(appId);

The StitchClient only needs to be resolved once from StitchClientFactory.create() and it can be used for the lifetime of an application.

Authenticate anonymously

stitchClientPromise.then(stitchClient => stitchClient.login())
  .then(() => console.log('logged in as: ' + stitchClient.authedId()))
  .catch(e => console.log('error: ', e));

Access MongoDB APIs

stitchClientPromise.then(stitchClient => {
  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:
  const userId = stitchClient.authedId();
  return 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));

Execute a function

stitchClientPromise.then(stitchClient => 
  stitchClient.executeFunction('myFunc', 1, 'arg2', {arg3: true})
).then(result => console.log('success: ', result))
  .catch(e => console.log('error: ', e));

Execute a service function

stitchClientPromise.then(stitchClient =>
  stitchClient.executeServiceFunction('http1', 'get', {url: 'https://domain.org'})
).then(result => console.log('success: ', result))
  .catch(e => console.log('error: ', e));

Current Tags

  • 3.18.0                                ...           latest (8 months ago)

107 Versions

  • 3.18.0 [deprecated]           ...           8 months ago
  • 3.17.1 [deprecated]           ...           8 months ago
  • 3.17.0 [deprecated]           ...           8 months ago
  • 3.16.0 [deprecated]           ...           8 months ago
  • 3.15.0 [deprecated]           ...           8 months ago
  • 3.14.0 [deprecated]           ...           9 months ago
  • 3.13.0 [deprecated]           ...           9 months ago
  • 3.12.1 [deprecated]           ...           9 months ago
  • 3.12.0 [deprecated]           ...           9 months ago
  • 3.11.0 [deprecated]           ...           9 months ago
  • 3.10.0 [deprecated]           ...           10 months ago
  • 3.9.0 [deprecated]           ...           a year ago
  • 3.8.1 [deprecated]           ...           a year ago
  • 3.8.0 [deprecated]           ...           a year ago
  • 3.7.0 [deprecated]           ...           a year ago
  • 3.6.0 [deprecated]           ...           a year ago
  • 3.5.0 [deprecated]           ...           a year ago
  • 3.4.0 [deprecated]           ...           a year ago
  • 3.3.0 [deprecated]           ...           a year ago
  • 3.2.24 [deprecated]           ...           2 years ago
  • 3.2.23 [deprecated]           ...           2 years ago
  • 3.2.22 [deprecated]           ...           2 years ago
  • 3.2.21 [deprecated]           ...           2 years ago
  • 3.2.20 [deprecated]           ...           2 years ago
  • 3.2.18 [deprecated]           ...           2 years ago
  • 3.2.17 [deprecated]           ...           2 years ago
  • 3.2.16 [deprecated]           ...           2 years ago
  • 3.2.15 [deprecated]           ...           2 years ago
  • 3.2.13 [deprecated]           ...           2 years ago
  • 3.2.11 [deprecated]           ...           2 years ago
  • 3.2.10 [deprecated]           ...           2 years ago
  • 3.2.9 [deprecated]           ...           2 years ago
  • 3.2.8 [deprecated]           ...           2 years ago
  • 3.2.7 [deprecated]           ...           2 years ago
  • 3.2.5 [deprecated]           ...           2 years ago
  • 3.2.4 [deprecated]           ...           2 years ago
  • 3.2.3 [deprecated]           ...           2 years ago
  • 3.2.2 [deprecated]           ...           2 years ago
  • 3.2.1 [deprecated]           ...           2 years ago
  • 3.2.0 [deprecated]           ...           2 years ago
  • 3.1.7 [deprecated]           ...           3 years ago
  • 3.1.6 [deprecated]           ...           3 years ago
  • 3.1.5 [deprecated]           ...           3 years ago
  • 3.1.4 [deprecated]           ...           3 years ago
  • 3.1.3 [deprecated]           ...           3 years ago
  • 3.1.2 [deprecated]           ...           3 years ago
  • 3.1.1 [deprecated]           ...           3 years ago
  • 3.1.0 [deprecated]           ...           3 years ago
  • 3.0.7 [deprecated]           ...           3 years ago
  • 3.0.6 [deprecated]           ...           3 years ago
  • 3.0.5 [deprecated]           ...           3 years ago
  • 3.0.4 [deprecated]           ...           3 years ago
  • 3.0.3 [deprecated]           ...           3 years ago
  • 3.0.2 [deprecated]           ...           3 years ago
  • 3.0.1 [deprecated]           ...           3 years ago
  • 2.3.1 [deprecated]           ...           3 years ago
  • 2.3.0 [deprecated]           ...           3 years ago
  • 2.2.0 [deprecated]           ...           3 years ago
  • 2.1.0 [deprecated]           ...           3 years ago
  • 2.0.1 [deprecated]           ...           3 years ago
  • 2.0.0 [deprecated]           ...           3 years ago
  • 1.2.0 [deprecated]           ...           3 years ago
  • 1.1.9 [deprecated]           ...           3 years ago
  • 1.1.8 [deprecated]           ...           3 years ago
  • 1.1.7 [deprecated]           ...           3 years ago
  • 1.1.6 [deprecated]           ...           3 years ago
  • 1.1.5 [deprecated]           ...           3 years ago
  • 1.1.4 [deprecated]           ...           3 years ago
  • 1.1.3 [deprecated]           ...           3 years ago
  • 1.1.2 [deprecated]           ...           3 years ago
  • 1.1.1 [deprecated]           ...           3 years ago
  • 1.1.0 [deprecated]           ...           3 years ago
  • 1.0.11 [deprecated]           ...           3 years ago
  • 1.0.10 [deprecated]           ...           3 years ago
  • 1.0.9 [deprecated]           ...           3 years ago
  • 1.0.8 [deprecated]           ...           3 years ago
  • 1.0.6 [deprecated]           ...           3 years ago
  • 1.0.5 [deprecated]           ...           3 years ago
  • 1.0.4 [deprecated]           ...           3 years ago
  • 1.0.3 [deprecated]           ...           3 years ago
  • 1.0.2 [deprecated]           ...           3 years ago
  • 1.0.1 [deprecated]           ...           3 years ago
  • 1.0.0 [deprecated]           ...           3 years ago
  • 0.0.28 [deprecated]           ...           3 years ago
  • 0.0.27 [deprecated]           ...           3 years ago
  • 0.0.25 [deprecated]           ...           3 years ago
  • 0.0.24 [deprecated]           ...           3 years ago
  • 0.0.23 [deprecated]           ...           3 years ago
  • 0.0.22 [deprecated]           ...           3 years ago
  • 0.0.21 [deprecated]           ...           3 years ago
  • 0.0.20 [deprecated]           ...           4 years ago
  • 0.0.18 [deprecated]           ...           4 years ago
  • 0.0.17 [deprecated]           ...           4 years ago
  • 0.0.16 [deprecated]           ...           4 years ago
  • 0.0.15 [deprecated]           ...           4 years ago
  • 0.0.14 [deprecated]           ...           4 years ago
  • 0.0.13 [deprecated]           ...           4 years ago
  • 0.0.12 [deprecated]           ...           4 years ago
  • 0.0.11 [deprecated]           ...           4 years ago
  • 0.0.10 [deprecated]           ...           4 years ago
  • 0.0.8 [deprecated]           ...           4 years ago
  • 0.0.7 [deprecated]           ...           4 years ago
  • 0.0.6 [deprecated]           ...           4 years ago
  • 0.0.5 [deprecated]           ...           4 years ago
  • 0.0.4 [deprecated]           ...           4 years ago
  • 0.0.3 [deprecated]           ...           4 years ago
  • 0.0.1 [deprecated]           ...           4 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (7)
Dev Dependencies (33)

Copyright 2014 - 2017 © taobao.org |