
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
ask-sdk-mongodb-persistence-adapter
Advanced tools
MongoDB based implementation package of PersistenceAdapter interface for Node.js
ASK SDK MongoDB Persistence Adapter package contains implementation of persistence adapter in Core SDK ('ask-sdk-core') based on AWS SDK.

The ASK SDK v2 for Node.js is an open-source Alexa CustomSkill Development Kit. ASK SDK v2 for Node.js makes it easier for you to build highly engaging skills, by allowing you to spend more time on implementing features and less on writing boiler-plate code.
ASK SDK MongoDB Persistence Adapter package is an addon package for the core SDK ('ask-sdk-core') and thus has peer dependency of the core SDK package. From within your NPM project, run the following commands in the terminal to install them:
npm install --save ask-sdk-mongodb-persistence-adapter
You can find all the documentation here.
How to create a instance of MongoDBPersistenceAdapter and PartitionKeyGenerator:
let { MongoDBPersistenceAdapter, PartitionKeyGenerators } = require('ask-sdk-mongodb-persistence-adapter');
let options = {
databaseName: 'myDb',
collectionName: 'myCollection',
mongoURI: 'mongodb+srv://<username>:<password>@<cluster>.mongodb.net/',
partitionKeyGenerator: (requestEnvelope) => {
return PartitionKeyGenerators.userId(requestEnvelope);
},
};
let adapter = new MongoDBPersistenceAdapter(options);
mongodb npm package:let { MongoDBPersistenceAdapter, PartitionKeyGenerators } = require('ask-sdk-mongodb-persistence-adapter');
let { MongoClient } = require('mongodb');
let mongoClient = new MongoClient('mongodb+srv://<username>:<password>@<cluster>.mongodb.net/')
let options = {
databaseName: 'myDb',
collectionName: 'myCollection',
mongoDBClient: mongoClient,
partitionKeyGenerator: (requestEnvelope) => {
return PartitionKeyGenerators.userId(requestEnvelope);
},
}
let adapter = new MongoDBPersistenceAdapter(options);
finally we have to add this new adapter to the SkillBuilders object with the method withPersistenceAdapter:
exports.handler = Alexa.SkillBuilders.custom()
.addRequestHandlers(
LaunchRequestHandler,
HelloWorldIntentHandler,
HelpIntentHandler,
CancelAndStopIntentHandler,
FallbackIntentHandler,
SessionEndedRequestHandler,
IntentReflectorHandler)
.addErrorHandlers(
ErrorHandler)
.withPersistenceAdapter(adapter)
.lambda();
Check the MongoDBPersistenceAdapter full specification here.
Check the PartitionKeyGenerator full specification here.
The ASK SDK MongoDB Persistence Adapter package for Node.js bundles TypeScript definition files for use in TypeScript projects and to support tools that can read .d.ts files. Our goal is to keep these TypeScript definition files updated with each release for any public api.
Before you can begin using these TypeScript definitions with your project, you need to make sure your project meets a few of these requirements:
npm install --save-dev @types/node
To use the TypeScript definition files within a Node.js project, simply import ask-sdk-mongodb-persistence-adapter as below:
In a TypeScript file:
import * as Adapter from 'ask-sdk-mongodb-persistence-adapter';
In a JavaScript file:
const Adapter = require('ask-sdk-mongodb-persistence-adapter');
For bug reports, feature requests and questions, we would like to hear about it. Search the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of the SDK, Node.js or browser environment and OS you’re using. Please include a stack trace and reduced repro case when appropriate, too.
This Adapter is distributed under the Apache License, Version 2.0, see LICENSE for more information.
FAQs
MongoDB based implementation package of PersistenceAdapter interface for Node.js
The npm package ask-sdk-mongodb-persistence-adapter receives a total of 22 weekly downloads. As such, ask-sdk-mongodb-persistence-adapter popularity was classified as not popular.
We found that ask-sdk-mongodb-persistence-adapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.