Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skratchdot/mongodb-wild
Adds a wildcard search to the mongodb shell
https://github.com/skratchdot/mongodb-wild
Last synced: 27 days ago
JSON representation
Adds a wildcard search to the mongodb shell
- Host: GitHub
- URL: https://github.com/skratchdot/mongodb-wild
- Owner: skratchdot
- Created: 2012-05-01T03:09:45.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-25T04:43:22.000Z (over 10 years ago)
- Last Synced: 2024-10-13T23:37:09.954Z (30 days ago)
- Language: JavaScript
- Homepage: http://skratchdot.github.com/mongodb-wild/
- Size: 129 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MongoDB - wild.js #
[Project Page](http://skratchdot.com/projects/mongodb-wild/)
[Source Code](https://github.com/skratchdot/mongodb-wild/)
[Issues](https://github.com/skratchdot/mongodb-wild/issues/)## Description: ##
Adds a wildcard search to the mongodb shell. You can run the new
wild() function on a collection, or on a query result.
The search is performed by converting each document to json,
and then running a regex on that json.## Usage: ##
```javascript
// Search entire users collection for Bob
db.users.wild('Bob');
db.users.wild(/Bob/gi);
db.users.find().wild('Bob');// Search for exact values of 'Bob'
db.users.wild(': "Bob"');// Search for exact keys called 'Bob'
db.users.wild('"Bob" :');// Search for documents containing 'Bob', filtering by last name of 'Smith'
db.users.wild('Bob', {'name.last' : 'Smith'});
db.users.find({'name.last' : 'Smith'}).wild('Bob');
```## Installation: ##
Download: [wild.js](https://github.com/skratchdot/mongodb-wild/raw/master/wild.js)
### Option 1 ###
Add this script to your .mongorc.js file.
See: [http://www.mongodb.org/display/DOCS/Overview+-+The+MongoDB+Interactive+Shell#Overview-TheMongoDBInteractiveShell-.mongorc.js](http://www.mongodb.org/display/DOCS/Overview+-+The+MongoDB+Interactive+Shell#Overview-TheMongoDBInteractiveShell-.mongorc.js)
### Option 2 ###
Start the shell after executing this script
mongo --shell wild.js