![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
mongodb-stitch
Advanced tools
[![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 original source is located in src/
.
To transpile to pure JS, run npm run build
which places the output into dist/
.
Construct a simple app-wide client:
import { StitchClient } from 'mongodb-stitch';
let appId = 'sample-app-ovmyj';
let stitchClient = new StitchClient(appId);
Authenticate anonymously:
stitchClient.login()
.then(() => console.log('logged in as: ' + stitchClient.authedId()))
.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));
Execute a function:
stitchClient.executeFunction('myFunc', 1, 'arg2', {arg3: true})
.then(result => console.log('success: ', result))
.catch(e => console.log('error: ', e));;
Execute a service function:
stitchClient.executeServiceFunction('http1', 'get', {url: 'https://domain.org'})
.then(result => console.log('success: ', result))
.catch(e => console.log('error: ', e));;
FAQs
[![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 npm package mongodb-stitch receives a total of 207 weekly downloads. As such, mongodb-stitch popularity was classified as not popular.
We found that mongodb-stitch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.