Skip to main content

Developer README for the mongodb adaptor

Source: https://github.com/OpenFn/adaptors/tree/main/packages/mongodb

Language MongoDB

Language Pack for building expressions and operations for use with MongoDB.

Documentation

sample configuration

{
"username": "something",
"password": "secret",
"clusterUrl": "yourCluster-xxxyzzz.mongodb.net"
}

insertDocuments

insertDocuments({
database: 'yourDb',
collection: 'yourCollection',
documents: state => {
return state.data.map(item => {
return { name: item.name, age: item.age };
});
},
// callback: (state) => state, // optional
});

findDocuments

findDocuments({
database: 'yourDb',
collection: 'yourCollection',
query: state => {
return { name: 'stu' };
},
// callback: (state) => state, // optional
});

Development

Clone the adaptors monorepo. Follow the Getting Started guide inside to get set up.

Run tests using pnpm run test or pnpm run test:watch

Build the project using pnpm build.

To just build the docs run pnpm build docs