diff --git a/examples/with-mongodb/.env.local.example b/examples/with-mongodb/.env.local.example
index 9dead415dc211..18ea9c3cc8c6a 100644
--- a/examples/with-mongodb/.env.local.example
+++ b/examples/with-mongodb/.env.local.example
@@ -1 +1 @@
-MONGODB_URI=
\ No newline at end of file
+MONGODB_URI="YOUR_MONGODB_CONNECTION_STRING"
\ No newline at end of file
diff --git a/examples/with-mongodb/app/actions.ts b/examples/with-mongodb/app/actions.ts
new file mode 100644
index 0000000000000..c4c4c028f5521
--- /dev/null
+++ b/examples/with-mongodb/app/actions.ts
@@ -0,0 +1,19 @@
+"use server";
+
+import client from "@/lib/mongodb";
+
+export async function testDatabaseConnection() {
+ let isConnected = false;
+ try {
+ const mongoClient = await client.connect();
+ // Send a ping to confirm a successful connection
+ await mongoClient.db("admin").command({ ping: 1 });
+ console.log(
+ "Pinged your deployment. You successfully connected to MongoDB!",
+ ); // because this is a server action, the console.log will be outputted to your terminal not in the browser
+ return !isConnected;
+ } catch (e) {
+ console.error(e);
+ return isConnected;
+ }
+}
diff --git a/examples/with-mongodb/app/app-demo/page.tsx b/examples/with-mongodb/app/app-demo/page.tsx
new file mode 100644
index 0000000000000..bff92188d516e
--- /dev/null
+++ b/examples/with-mongodb/app/app-demo/page.tsx
@@ -0,0 +1,148 @@
+import Image from "next/image";
+import { testDatabaseConnection } from "../actions";
+import Link from "next/link";
+
+export default async function Home() {
+ const isConnected = await testDatabaseConnection();
+
+ return (
+
+
+
+ App Router: Get started by editing
+ app/app-demo/page.tsx
+