[SERVER-23108] db.grep() shell utility to search all collections Created: 14/Mar/16  Updated: 06/Dec/22  Resolved: 03/Dec/21

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: features we're not sure of

Type: Improvement Priority: Major - P3
Reporter: navin kumar Assignee: Backlog - Server Tooling and Methods (STM) (Inactive)
Resolution: Won't Fix Votes: 0
Labels: move-stm
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Tooling & Methods
Participants:

 Description   

Default behavior:
db.grep("search term")
OR
db.grep(ObjectId("56e69b8abd177faa0aab0bfd"))
Goes through all indexed fields in all collections and lists all collections where matches exist

Quick way to test:
https://gist.github.com/blowhacker/c930142e967d3a123519
copy the contents of this gist into a mongo shell and try db.grep( <something to grep>)



 Comments   
Comment by Brooke Miller [ 03/Dec/21 ]

We've deprecated the mongo shell in favor of the new mongosh. Unfortunately, we aren't able to pursue improvements to the deprecated shell except in extreme cases, such as critical security fixes. Please start making use of mongosh and let us know if it works for you in this case.

Comment by Ramon Fernandez Marina [ 29/Mar/16 ]

vain, every piece of functionality that gets added is something that needs to be properly tested and maintained. In this particular case this functionality is something that can be implemented outside the database, so it's preferable to keep it that way to simplify our code base.

You can use the .mongorc.js file to implement this functionality for yourself. If you think others may find it useful you can always share it – please take a look at mongo-hacker for a great example of other useful functionality that can be added to the shell via the .mongorc.js file.

Regards,
Ramón

Comment by navin kumar [ 22/Mar/16 ]

Thanks for taking the time to look at the ticket and pull request.

Would you be able to share how you make decisions around pull requests? How do you arrive at conclusions on what's a useful feature and what's not? From a quick browse around the "features we're not sure of" section, I appreciate it can't be an easy task.

Regards,
Navin

Comment by Ramon Fernandez Marina [ 22/Mar/16 ]

Thanks for opening a ticket and taking the time to submit a pull request vain. Unfortunately this is not a feature we're going to consider at this time, so I'm going to close the pull request. We'll keep this ticket open for the time being to record any further discussion on this functionality.

Regards,
Ramón.

Generated at Thu Feb 08 04:02:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.