Below you can find examples in js and ts of how to store basic user info using abc.db. I have used hard coded users but you probably wouldn't.
(async() => {
const AbcDB = require("abc.db");
const DB = new AbcDB("mongo string", "data");
const UserDB = DB.Collection("users");
const users = [
{
name: "John Smith",
age: 23,
email: "john.smith@email.com"
},
{
name: "Amanda Baker",
age: 32,
email: "a.baker@anotheremail.com"
}
];
for (const user in users) {
await UserDB.set(user.email, user);
}
const user = await UserDB.get("john.smith@email.com");
})();
import AbcDB from "abc.db";
(async() => {
interface User {
name: string;
age: number;
email: string;
}
const DB = new AbcDB("mongo string", "data");
const UserDB = DB.Collection("users");
const users: Array<User> = [
{
name: "John Smith",
age: 23,
email: "john.smith@email.com"
},
{
name: "Amanda Baker",
age: 32,
email: "a.baker@anotheremail.com"
}
];
for (const user in users) {
await UserDB.set(user.email, user);
}
const user: User = await UserDB.get("john.smith@email.com");
})();