Skip to content

Instantly share code, notes, and snippets.

@robwelan
Last active December 5, 2019 23:56
Show Gist options
  • Save robwelan/401a9d6d41a3f4506e2130cc3fcf1138 to your computer and use it in GitHub Desktop.
Save robwelan/401a9d6d41a3f4506e2130cc3fcf1138 to your computer and use it in GitHub Desktop.
cot-blog-set-up-mongodb.js
// In your gatsby-config.js
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
});
module.exports = {
plugins: [
{
resolve: 'gatsby-source-mongodb',
options: {
collection: [
'apps',
'games',
'users',
],
clientOptions: {
useUnifiedTopology: true,
},
connectionString: `mongodb+srv://${process.env.GATSBY_MONGOBD_ATLAS_ADMINUSER}:${process.env.GATSBY_MONGOBD_ATLAS_PASSWORD}@cluster0-l8hlk.mongodb.net/test?retryWrites=true&w=majority`,
dbName: 'cotdata',
},
},
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment