コンテンツにスキップ
Version: v1.2
目次

connect()

このコンテンツはまだ日本語訳がありません。

This function is used to connect simply-xp to a database, and configure client options.

Parameter Type Required Description
db string ✅ MongoDB Connection String
options ConnectionOptions ❌ The options for the user.
  • Promise<void>
  • new Error() - If the URI was not provided.
const { connect } = require("simply-xp");
const connectionString =
"mongodb+srv://myDatabaseUser:D1fficultP%40ssw0rd@cluster0.example.mongodb.net/?retryWrites=true&w=majority";
connect(connectionString) // Returns Promise<void>
.catch((err) => console.log(err)); // Returns the error

Parameter Type Required Description
notify boolean ❌ Log { XP } Database Connected. [Default: true]