API Reference / modelence / server / dbUsers

const dbUsers: Store<{ authMethods: ZodObject<{ google: ZodOptional<ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id: string; }, { id: string; }>>; password: ZodOptional<ZodObject<{ hash: ZodString; }, "strip", ZodTypeAny, { hash: string; }, { hash: string; }>>; }, "strip", ZodTypeAny, { google?: { id: string; }; password?: { hash: string; }; }, { google?: { id: string; }; password?: { hash: string; }; }>; createdAt: ZodDate; emails: ZodOptional<ZodArray<ZodObject<{ address: ZodString; verified: ZodBoolean; }, "strip", ZodTypeAny, { address: string; verified: boolean; }, { address: string; verified: boolean; }>, "many">>; handle: ZodString; }, Record<string, (this, …args) => any>>

Defined in: src/auth/db.ts:28

Database collection for storing user accounts with authentication methods and profile information.

This is where signupWithPassword automatically creates new users.

Example

// Create a new user
const result = await dbUsers.insertOne({
  handle: 'john_doe',
  emails: [{ address: 'john@example.com', verified: false }],
  createdAt: new Date(),
  authMethods: {
    password: { hash: 'hashed_password' }
  }
});

// Find user by email
const user = await dbUsers.findOne(
  { 'emails.address': 'john@example.com' }
);

API Reference / modelence / server / dbUsers

const dbUsers: Store<{ authMethods: ZodObject<{ google: ZodOptional<ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id: string; }, { id: string; }>>; password: ZodOptional<ZodObject<{ hash: ZodString; }, "strip", ZodTypeAny, { hash: string; }, { hash: string; }>>; }, "strip", ZodTypeAny, { google?: { id: string; }; password?: { hash: string; }; }, { google?: { id: string; }; password?: { hash: string; }; }>; createdAt: ZodDate; emails: ZodOptional<ZodArray<ZodObject<{ address: ZodString; verified: ZodBoolean; }, "strip", ZodTypeAny, { address: string; verified: boolean; }, { address: string; verified: boolean; }>, "many">>; handle: ZodString; }, Record<string, (this, …args) => any>>

Defined in: src/auth/db.ts:28

Database collection for storing user accounts with authentication methods and profile information.

This is where signupWithPassword automatically creates new users.

Example

// Create a new user
const result = await dbUsers.insertOne({
  handle: 'john_doe',
  emails: [{ address: 'john@example.com', verified: false }],
  createdAt: new Date(),
  authMethods: {
    password: { hash: 'hashed_password' }
  }
});

// Find user by email
const user = await dbUsers.findOne(
  { 'emails.address': 'john@example.com' }
);