I'm trying to set up Keystone using MongoDB as the database. Upon running keystone-next, the command errors out with the following error message: Error: Invalid db configuration. Please specify db.provider as either "sqlite" or "postgresql" at getDBProvider.
There's no much clarity on their docs on what values to pass as db.provider to use MongoDB as database.
Here are the contents of keystone.ts:
import { config, createSchema } from '@keystone-next/keystone/schema'
import 'dotenv/config'
const databaseUrl =
process.env.DATABASE_URL || 'mongodb://localhost/keystone-project'
const sessionConfig = {
maxAge: 60 * 60 * 24 * 90,
secret: process.env.COOKIE_SECRET || 'keystone-project-secret'
}
export default config({
server: {
cors: {
origin: [process.env.FRONTEND_URL],
credentials: true
}
},
db: {
provider: 'mongoose',
url: databaseUrl
// TODO: add data seeding here
},
lists: createSchema({
// Schema items go here
}),
ui: {
// Change this for roles}
isAccessAllowed: () => true
}
// Add session values here
})
Here are the project's dependencies from package.json:
{
...
"dependencies": {
"@keystone-next/admin-ui": "^14.1.3",
"@keystone-next/auth": "^31.0.0",
"@keystone-next/cloudinary": "^6.0.6",
"@keystone-next/fields": "^14.0.0",
"@keystone-next/keystone": "^24.0.1",
"@keystone-next/types": "^24.0.0",
"@keystonejs/server-side-graphql-client": "^2.1.2",
"@types/nodemailer": "^6.4.4",
"dotenv": "^10.0.0",
"next": "^11.1.0",
"nodemailer": "^6.6.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"stripe": "^8.169.0"
},
"devDependencies": {
"@babel/preset-env": "^7.15.4",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@types/node": "^16.7.10",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"babel-eslint": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-html": "^6.1.2",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.3.2",
"typescript": "^4.3.5"
},
...
}