MongoDB Admin
One script reply has been approved by the moderators Verified

Admin panel for the sample Customers dataset of MongoDB Cloud

Created by adam186 521 days ago
Static preview only: No backend 
This is a static preview of the app and there is no backend. As such, the interactivity requiring script execution is non functional. To see the fully functional app, edit/run it in Windmil by clicking the button above.

Scripts used

import { Resource } from "https://deno.land/x/windmill@v1.86.0/mod.ts";
import { MongoClient, ObjectId } from "https://deno.land/x/atlas_sdk@v1.1.1/mod.ts";

 * @param data_source For example: `Cluster0`
 * @param filter For example: `{ "_id": "01234" }`
 * Find out more at:
 * https://www.mongodb.com/docs/manual/reference/method/db.collection.deleteOne/
export async function main(
  auth: Resource<"mongodb_rest">,
  data_source: string,
  database: string,
  collection: string,
  document_id: string
) {
  const client = new MongoClient({
    endpoint: auth.endpoint,
    dataSource: data_source,
    auth: { apiKey: auth.api_key },
  const documents = client.database(database).collection(collection)
  return await documents.deleteOne({
    _id: new ObjectId(document_id)