0.0.1 • Published 6 years ago
gatsby-source-mongo v0.0.1
Mongo source plugin for Gatsby
Define database credentials in config
module.exports = {
siteMetadata: {
title: 'Gatsby Default Starter',
},
plugins: [
'gatsby-plugin-react-helmet',
{
resolve: `gatsby-source-mongo`,
options: {
server: {
address: 'localhost',
},
auth: {
user: 'dmitry',
password: '1234'
},
srv: false,
dbName: `test`,
query: 'ssl=true&replicaSet=Cluster0-shard-0&authSource=admin',
collection: [`pages`]
},
},
],
};
Use graphql requests
export const query = graphql`
query PageQuery($path: String!) {
mongoPages(path: { eq: $path }) {
id
title
path
}
}
`
0.0.1
6 years ago