MongoDB Programming Tips


How to Create and Use Indexes in MongoDB Database

MongoDB supports creation of indexes to speed up queries for specific application needs. With suitable indexes, MongoDB doesn’t need to scan every document before returning results. This substantially speeds up queries especially for large collections where ordering and filtering is needed. MongoDB automatically creates a uniq index on the _id field during the creation of […]

How to Run Like Queries in MongoDB

When working with textual data in mongodb, you may want to fetch documents with partial match on a field. You can use the $regex operator in mongodb for running like queries. By default, the like query using $regex is case sensitive. Assume that you have collection in your mongodb containing names of the countries. A […]