> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# HOW TO : Search for a record in MongoDB based on length
- URL: https://kudithipudi.org/how-to-search-for-a-record-in-mongodb-based-on-the-length/
- Published: 2014-02-13T19:40:11.000Z
- Updated: 2014-02-13T19:40:11.000Z
- Description: Quick entry for my own records. MongoDB is one of the popular open source document database that is part of the nosql movement. One of the...
- Author: admin
- Tags: Databases, HOWTO, Technology, Uncategorized, #wp, #wp-post, #Import 2026-08-23 02:32

Quick entry for my own records.

[MongoDB](http://www.mongodb.org/?ref=kudithipudi.org) is one of the popular open source document database that is part of the nosql movement. One of the applications we deployed at work uses MongoDB as an internal storage engine. We ran into an issue where MongoDB was trying to replicate data to [MySQL](http://dev.mysql.com/?ref=kudithipudi.org) and the replication stopped because of a size mismatch for an object between MongoDB and MySQL. Essentially MongoDB was trying to insert a record into MySQL that was larger than the defined length.

Here is the query we used to find the culprit objects. We used the awesome [Robomongo](http://robomongo.org/?ref=kudithipudi.org) client to connect to the MongoDB instance.

```
db.some_table_to_search.find({$where:"this.some_column_to_search.length > 40"})
```

Breaking down the command

db -> Specifies the database you are trying to search

some\_table\_to\_search -> Specifie the table you are trying to search

some\_column\_to\_search -> Specified the particular column you are trying to search.

In this specific example, we were looking for entries longer than 40 characters for this column.

If you come from the traditional RDBMS world, here is a [link](http://docs.mongodb.org/manual/reference/sql-comparison/?ref=kudithipudi.org) from MongoDB comparing terminology between RDBMS and MongoDB.

[http://docs.mongodb.org/manual/reference/sql-comparison/](http://docs.mongodb.org/manual/reference/sql-comparison/?ref=kudithipudi.org)