Skip to content

Instantly share code, notes, and snippets.

@skolhustick
Created September 3, 2022 14:25
Show Gist options
  • Save skolhustick/938830b47e24226362ce0dfd39d56000 to your computer and use it in GitHub Desktop.
Save skolhustick/938830b47e24226362ce0dfd39d56000 to your computer and use it in GitHub Desktop.
astro-mongodob-users.js
// /src/lib/users.js
import { Users } from "./mongodb";
export const getAllUsers = async () => {
const users = await (await Users()).find({}).toArray();
return users;
};
export const createUser = async (newUser) => {
const user = await (await Users()).insert(newUser);
return user;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment