有谁知道如何将 grails 应用程序连接到 mongoDB 云数据库?
Does anyone know how to connect grails app to mongoDB cloud database?
我在 MongoDB atlas 中创建了一个数据库,我想创建一个将连接到该数据库的 Grails 应用程序,但我不知道该怎么做。这是我在“application.yml”文件中尝试的方法,但它不起作用。
environments:
development:
grails:
mongodb:
host: "clustertpt.nfycx.mongodb.net"
port: 27017
username: "x"
password: "x"
databaseName: "tpt"
production:
grails:
mongodb:
host: "clustertpt.nfycx.mongodb.net"
port: 27017
username: "x"
password: "x"
databaseName: "tpt
谢谢
我试过这个方法,成功了!
environments:
development:
grails:
mongodb:
url: "mongodb+srv://x:x@clustertpt.nfycx.mongodb.net/tpt?retryWrites=true&w=majority"
test:
development:
grails:
mongodb:
url: "mongodb+srv://x:x@clustertpt.nfycx.mongodb.net/tpt?retryWrites=true&w=majority"
production:
development:
grails:
mongodb:
url: "mongodb+srv://x:x@clustertpt.nfycx.mongodb.net/tpt?retryWrites=true&w=majority"
我在 MongoDB atlas 中创建了一个数据库,我想创建一个将连接到该数据库的 Grails 应用程序,但我不知道该怎么做。这是我在“application.yml”文件中尝试的方法,但它不起作用。
environments:
development:
grails:
mongodb:
host: "clustertpt.nfycx.mongodb.net"
port: 27017
username: "x"
password: "x"
databaseName: "tpt"
production:
grails:
mongodb:
host: "clustertpt.nfycx.mongodb.net"
port: 27017
username: "x"
password: "x"
databaseName: "tpt
谢谢
我试过这个方法,成功了!
environments:
development:
grails:
mongodb:
url: "mongodb+srv://x:x@clustertpt.nfycx.mongodb.net/tpt?retryWrites=true&w=majority"
test:
development:
grails:
mongodb:
url: "mongodb+srv://x:x@clustertpt.nfycx.mongodb.net/tpt?retryWrites=true&w=majority"
production:
development:
grails:
mongodb:
url: "mongodb+srv://x:x@clustertpt.nfycx.mongodb.net/tpt?retryWrites=true&w=majority"