Created
February 8, 2014 21:50
-
-
Save samyakbhuta/8890850 to your computer and use it in GitHub Desktop.
Quick and dirty mongo general purpose command line utility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage : ./mongo-find <db-name> <collection> <attribute> <attribute-value> | |
mongo $1 --eval \ | |
" | |
print('Finding ....'); | |
cursor = db.$2.find({'$3':'$4'}); | |
while ( cursor.hasNext() ) { | |
printjson( cursor.next() ); | |
} | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment