Use this file to discover all available pages before exploring further.
Markers are the primary way users annotate locations on a BuzzTrip map. Every marker is linked to a places record — a de-duplicated store of geographic point-of-interest data. When a marker is created, the backend checks whether a place already exists at the given coordinates before inserting a new one.Markers can also be assigned to one or more collections, which are managed via collection_links join records. This makes it easy to group related pins (e.g. “Restaurants”, “Hotels”) without duplicating the marker itself.All operations require authentication via the authedQuery / authedMutation wrappers.
Retrieves all markers on a map enriched with their associated place data, forming a CombinedMarker array. An optional markerId filter returns only that single marker.Position (lat / lng) on the returned object is sourced from the linked place record when available, falling back to the value stored directly on the marker.API path:api.maps.markers.getMarkersView Type:authedQuery — authentication required
import { useQuery } from "convex/react";import { api } from "@/convex/_generated/api";import { Id } from "@/convex/_generated/dataModel";const mapId = "abc123" as Id<"maps">;// All markers on the mapconst markers = useQuery(api.maps.markers.getMarkersView, { mapId });// Single markerconst single = useQuery(api.maps.markers.getMarkersView, { mapId, markerId: "marker_xyz" as Id<"markers">,});markers?.forEach((m) => { console.log(m.title, m.lat, m.lng, m.place.address);});
Inserts a new marker onto a map. Before inserting, the backend checks whether a places record already exists at the provided lat/lng coordinates using the by_place_lat_lng index. If no existing place is found, a new one is created via createPlace. This de-duplicates geographic POI data across all maps.After the marker is inserted, collection_links join records are created for each ID in collectionIds.API path:api.maps.markers.createMarker Type:authedMutation — authentication required
Updates an existing marker’s fields and/or adjusts its collection assignments. Collection links can be added and removed in the same call.API path:api.maps.markers.editMarker Type:authedMutation — authentication required
Array of collection IDs for which links were successfully created, or null if none were added.
import { useMutation } from "convex/react";import { api } from "@/convex/_generated/api";import { Id } from "@/convex/_generated/dataModel";const editMarker = useMutation(api.maps.markers.editMarker);const result = await editMarker({ marker_id: "marker_xyz" as Id<"markers">, mapId: "abc123" as Id<"maps">, marker: { note: "Best visited on weekday mornings to avoid crowds", color: "#3a86ff", }, collectionIds_to_add: ["collection_must_see" as Id<"collections">], collectionIds_to_remove: ["collection_maybe" as Id<"collections">],});console.log("Removed links:", result.collectionLinksDeleted);console.log("Added links:", result.collectionLinksCreated);
Permanently deletes a marker document. Collection links referencing this marker are not automatically removed — handle that separately if required.API path:api.maps.markers.deleteMarker Type:authedMutation — authentication required
import { useMutation } from "convex/react";import { api } from "@/convex/_generated/api";import { Id } from "@/convex/_generated/dataModel";const deleteMarker = useMutation(api.maps.markers.deleteMarker);await deleteMarker({ markerId: "marker_xyz" as Id<"markers"> });