Created
September 3, 2022 14:25
-
-
Save skolhustick/938830b47e24226362ce0dfd39d56000 to your computer and use it in GitHub Desktop.
astro-mongodob-users.js
This file contains 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
// /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