Created
May 18, 2023 22:22
-
-
Save akobashikawa/f276ace55d0e2653b4d29c47b9af09c3 to your computer and use it in GitHub Desktop.
MongoDB Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("MongoDB Test"); | |
const mongoose = require("mongoose"); | |
mongoose.set("strictQuery", false); | |
async function main () { | |
// const url = `mongodb://127.0.0.1:27017/studio`; | |
const username = 'rulo_00'; | |
const password = 'secret'; | |
const dbname = 'studio'; | |
const url = `mongodb+srv://${username}:${password}@cluster0.ipmte.mongodb.net/${dbname}?retryWrites=true&w=majority`; | |
await mongoose.connect(url); | |
console.log('mongoose connected'); | |
}; | |
main().catch((err) => console.log(err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment