Create an Atlas Search index definition in the Atlas UI or via the API, specifying a custom analyzer: define a 'customAnalyzer' with a standard tokenizer and a lowercase token filter, then map the target field to use it
Use the lucene.keyword analyzer for exact-match fields (e.g. status, category) to disable tokenization: map those fields with analyzer: 'lucene.keyword' in the index definition
Enable faceting by adding a facet field mapping for low-cardinality string fields (type: 'stringFacet') and numeric/date fields (type: 'numberFacet'/'dateFacet') in the index
Run a $search aggregation with a facet collector: db.products.aggregate([{$searchMeta: {facet: {operator: {text: {query: 'laptop', path: 'description'}}, facets: {categoryFacet: {type: 'string', path: 'category'}}}}}])
Combine facet counts with document results in one pipeline using $facet or by running $search for documents and $searchMeta for facets in parallel client-side
Monitor Atlas Search index build status via the Atlas UI or the Search Index API; queries against a building index may return incomplete results
Known gotchas
Atlas Search indexes are separate from MongoDB query indexes ($indexStats does not show them); you must use the Atlas Search Index management APIs or UI to inspect them
Facet fields must be declared explicitly in the index mapping with a facet type; applying $searchMeta facets on a field not mapped as a facet type returns an error
Custom analyzers are defined per index, not globally; if you need the same analyzer on multiple collections you must define it in each index independently
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp