Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
search

Studio 3T Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

Search In… (aka Value Search)

Posted on: 23/06/2022 (last updated: 18/10/2022) by Dj Walker-Morgan

About Search In…

Search In... is a new feature in Studio 3T which we originally launched as Value Search. It allows users to perform wide-ranging searches on the values stored in a collection, database, or server. By default, for any search, Studio 3T will scan every document. It will search for a text (or regular expression) match in every field value or field name that exists in the document. 

This includes all embedded documents and arrays. Search In… will then report back on what matched. This will include the path to the matched field or name.

Starting Search In…

To open a Search In… view, select a collection, database, or server in the Connection Tree in the Studio 3T window. Then either select File > Search In… or right-click on the selected item and choose Search In….

The Search In… view will open. The tab title reflects where any future search take place.

Below that are three indicators. The first shows the server in use. The second is a selector for which database to search. The third is a selector for which collection, within that database, to search. If you select a server for your search, the second selector will default to <all databases> and the collection selector will be set to <all collections>.

Selecting a database when opening Search In…, or adjusting the database selector to a particular database, will enable the collections selector.

This restricts the search to the selected database, but can still search <all collections> within that database. 

Selecting a collection when opening Search In…, or adjusting the Collection selector to a particular collection, will further restrict the search to that particular collection.

Performing a Search

Once you have selected the scope of your Search In.. search, you can select on the Search type selector whether you want to search field values and names, just values, or just names. Then you can enter a search term in the search field. The search term can be plain text or a regular expression. 

The components of the Search In…bar

If you wish the search to be case-sensitive, check the Match Case field to toggle case-sensitive searches on.

Check the RegEx field to toggle the use of Regular Expressions if you want to use a regular expression as a search term. Search In… regular expressions use the Java regular expression engine. Refer to Regular Expressions In Studio 3T for a reference to the formats of regular expression accepted.

We will examine the Advanced Options toggle later in this article.

The search term is, by default, a match with plain text. The text will match anywhere in a value. For many use cases, this is sufficient to home in on relevant fields. Use regular expressions where you want more defined precision in your matches.

Value Conversion

Note that when searching, values in the database documents which are not string types are converted to strings. Names are always strings and searches as strings, so the conversion does not apply to them.

For example, numbers present as strings so a Search In… search for 10 as plain text would match with 10, 100, 90.10 stored as numbers. It would also match with 10/6/22, a stored date converted to a string, as well as K100 (a string which contains a number).

Plain Text searches will always simply match the sequence of characters.

Viewing Search In… Results

Pressing the Return key in the search field or clicking on the Search button begins the search. You can follow how the search is doing in the lower left of the view, where a progress meter and count of matches is shown. Also in the lower left is a “cancel” button (red circle with cross) which can terminate the search early.

Results showing for a simple value search

Each match is displayed in the five-column table. Whilst you can interact with the table as the search runs, the search term controls are only enabled when the search is complete. You will have to stop the search, or wait for it to finish, before you can adjust those settings.

Each row is made up of five elements, each one related to a match found by Value Search:

Database: The name of the database where this match is.

Collection: The name of the collection where this match is.

_id: The _id field of the document where the match is.

Path: The path, from the document’s root, to the field where the match is. Paths display in Studio 3T format. This is a field name that is optionally followed by a > and either a number or another field name. A number usually represents the index value of an array. This repeats as needed.

Value: The value of the field in which a match is found.

The Database, Collection, _id, and Path allow you to locate precisely where the value match is. 

The particular parts of field value or name that match are shown with a yellow background.

Viewing Matched Documents

For any match displayed in Search In…, you have two options.

  • Double-Clicking the row will open the document containing the match in the Document JSON Viewer. You can only view the document here.
  • Right-Clicking on the row will display the context menu for the row.

    View Document, like double-clicking, opens the document in the collection using the Document JSON Viewer.
    Open in Collection Tab will open a new Collection Tab with a query that selects only the matched document. From the Collection Tab, you can edit fields inline or view and edit the matched Document.
Options for Search In… matched documents

Advanced Options

Advanced options enable an extra level of control over how Search In… examines collections. 

Before scanning any collection’s documents, Search In… runs a query which will select the documents it searches. By default, this is an empty query which returns all documents in the collection. The Advanced options let you control what that query is. This allows you to focus search on specific fields, reduce the number of documents examined, or pre-sort the results.

You can create queries using the Collections Tab and Visual Query Builder. They can then be copy and pasted, or saved and loaded, into the Advanced options.

Query

The Query field takes a MongoDB query document specification. It is a pre-filtering stage for the documents in the value search. For example, if you only want to search documents where the country field is not “United States”, then you can set the query to:

{ “country”: { $ne: “United States” } }

Any document where the country field is not “United States” will move on to the Search In… search. Note that in this example, the result of the query would also return documents that did not have a country field at all (because null is not equal to United States). When doing a Search In… search with a query on multiple collections, remember that the same query will run on all the collections. If the query fails to match any documents – for example, because a field is being present in a collection – no fields in that collection will go on to be in the Search In… search.

Projection

The Projection field is useful in reducing the number of fields that pass into the Search In… search. By selecting fields for inclusion or exclusion, you can make sure that Search In… is retrieving fewer documents, but still thoroughly searching the rest of the fields. For example, if your collections have a large text record attached called notes which you don’t want searched, setting the Projection to { notes: 0 } will exclude that one field from the Search In… search. Again, this will be applied to all collections in scope.

Skip and Limit

Skip and Limit will, as they do in the Collections Tab and other queries, skip over a number of documents and then limit the number of documents returned by the query. If you want to only search 1000 documents in a collection, starting after the first 2000 documents, then setting Skip to 2000 would skip the first 2000 documents and setting Limit to 1000 would restrict the number of returned documents to a maximum of 1000.

Sort

Use the Sort field in Advanced options if you want the results to appear in a particular order. This will pre-sort the documents before they are passed on to the Search In… search. Again, it takes the same Sort specification as used in the Collections tab query bar and Visual Query Builder. 

That is a JSON list of field names with the values -1 or 1 to determine ascending or descending sorting for that field. Setting the Sort field to { birthdate: 1, username: 1} will sort the documents by ascending birthdate field value and ascending username text field value.

Here, we are doing a Search In… search that focusses on just the name and username fields, with a window that scans 50 documents (after skipping ten) from a collection sorted by birthdate and username. As you can see, this limits the results.


How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Dj Walker-Morgan

Dj has been around since Commodore had Pets and Apples grew everywhere. With a background in Unix and development, he's been around the technology business writing code or writing content ever since.

Article navigation

Related articles

  • The Value of Value Search – A Christmas Tale
  • What’s New in Studio 3T 2021.10 | Value Search, Better Task Scheduling and Import Data Masking
  • The Value of a Regular Expression: #Studio3T_AMA
  • What’s New In Studio 3T 2022.8 – IntelliShell Script Tasks and Enhanced Value Searches
  • Lesson 4, Exercise 2: Using Visual Query Builder to query a single array value

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in our Privacy Policy.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

HubSpot

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected