Skip to content

MongoDB

8 articles

Advanced Text Search in MongoDB

Explore six advanced examples of text search in MongoDB, from logical operators and exact phrase matching to stemming and relevance scoring with field weights.

mongodbjavascriptsearchdatabase queriestext indexing

Combine Facet Summaries with Search Results

Learn how to combine search results with facet summaries in one MongoDB aggregation pipeline call using the $facet stage to run multiple pipelines in parallel on the same input documents.

MongoDBAggregationDatabase QuerySearchFaceted Search

Custom Weighted Search Results

Learn how to calculate and assign custom weights to MongoDB search results using the $search stage combined with $project to create a weighted ranking system for your documents.

MongoDBsearchaggregationdatabaseweighted ranking

Geolocation Based Search

Implement location-based search in MongoDB by using the $geoNear aggregation stage and 2dsphere geospatial indexes to find stores and points of interest near a given coordinate.

mongodbjavascriptgeolocationsearchgeospatial index

Pagination with MongoDB using Aggregation Pipelines

Learn how to implement pagination in MongoDB using aggregation pipelines with practical JavaScript examples. Covers basic pagination, handling large datasets with $facet, and adding search functionality.

mongodbjavascriptaggregationsearchPaginationAggregation PipelinesDatabase Queries

Search, Text and Match Operator

MongoDB provides multiple operators for filtering and searching documents. Learn when to use $match for filtering, $search for text search, and $text for indexed field searches, plus how to combine them in aggregation pipelines.

MongoDBDatabase QueryText SearchAggregationQuery Operators

$text operator

The $text operator in MongoDB enables full-text search across indexed fields with automatic relevance scoring. This guide covers creating text indexes, using $text in aggregation pipelines, and sorting results by relevance.

MongoDBDatabaseText SearchAggregationFull-Text Search

Text Search in MongoDB

MongoDB's text search capabilities allow you to search string fields using text indexes and the $text operator. This guide covers basic queries, aggregation pipelines, complex search criteria, and how relevance scores are calculated using TF-IDF.

mongodbjavascripttextsearchtext searchdatabasesaggregation