Overview
Queries are read-only functions that fetch data from the Convex database. They automatically update in real-time when the underlying data changes.Users
current
Get the currently authenticated user’s profile. Location:convex/users.ts:16
Arguments
No arguments required.Returns
The current user object or null if not authenticated
User’s unique identifier
Timestamp when user was created
User’s display name
User’s email address
URL to user’s profile image
Timestamp when email was verified
Whether this is an anonymous user
Example
get
Get a user’s public profile by ID. Location:convex/users.ts:35
Arguments
The ID of the user to fetch
Returns
Example
Notes
- Only returns public fields (excludes email and emailVerificationTime)
- Returns null if user doesn’t exist
Messages
list
Get all messages in a chat room, ordered chronologically. Location:convex/messages.ts:15
Arguments
The room/channel identifier to fetch messages from
Returns
Array of message objects ordered by creation time (oldest first)
Message unique identifier
Timestamp when message was created
Room/channel identifier
ID of user who sent the message (optional for demo mode)
Message text content
Display name of message sender
Session identifier for demo mode tracking
Example
Presence
list
Get all active presence entries for a room, filtering out stale entries. Location:convex/presence.ts:29
Arguments
The room identifier to fetch presence data from
Returns
Array of active presence entries (within last 30 seconds)
Presence entry unique identifier
Timestamp when presence was created
Room identifier
User ID (optional for demo mode)
Session identifier for demo mode
Presence data object
Cursor position coordinates
Position coordinates (alias for cursor)
User status text
User’s display name
URL to user’s avatar
Color code for cursor/avatar
Alternative name field
Timestamp of last update
Example
Notes
- Automatically filters out entries older than 30 seconds (PRESENCE_TIMEOUT)
- Returns empty array if no active presence
Files
getUrl
Get the download URL for a file stored in Convex storage. Location:convex/files.ts:48
Arguments
The storage ID of the file
Returns
The URL to access the file, or null if file doesn’t exist
Example
list
List files for the current user or session. Location:convex/files.ts:57
Arguments
Session identifier for demo mode. Required if user is not authenticated.
Returns
Array of file objects with download URLs
File unique identifier
Timestamp when file was uploaded
Reference to Convex storage
ID of user who uploaded the file
Session identifier for demo uploads
Original filename
MIME type of the file
File size in bytes
Download URL for the file
Example
Notes
- For authenticated users: returns their files
- For demo mode: returns files for the given sessionId
- Returns empty array if neither userId nor sessionId is available