Database Reference
In-Depth Information
The search command works exactly as you would expect. All you need to do is tell
mongofiles what you are looking for, and it will try to find it for you, as in this example:
$ mongofiles search hello
connected to: 127.0.0.1
/tmp/hello_world 4953699
$ mongofiles search dict
connected to: 127.0.0.1
/tmp/dictionary 4953699
$
Again, nothing too exciting happens here. However, there is an important takeaway
that's worth noting. MongoDB can be as simple or as complex as you need it to be. The
mongofiles tool is only for reference use, and it includes very basic debugging. The good
news: MongoDB makes it easy to perform simple searches against your files. The
even better news: MongoDB also has your back if you want to write some insanely
complicated searches.
Deleting
The mongofiles command delete doesn't require much explanation, but it does deserve
a big warning. This command deletes files based on the filename. Thus, if you have more
than one file with the same name, this command will delete all of them. The following
snippet shows how to use the delete command:
$ mongofiles delete /tmp/hello_world
connected to: 127.0.0.1
$ mongofiles list
connected to: 127.0.0.1
/tmp/dictionary 4953699
$
Many people have commented in connection with this issue that deleting multiple
files with the same name is not a problem because no application would have duplicate
names. This is simply not true; and in many cases, it doesn't even make sense to enforce
unique names. For example, if your app lets users upload photos to their profiles, there's a
good chance that half the files you receive will be called photo.jpg or me.png .
Note
Of course, if you are unlikely to use mongofiles to manage your live data—and in truth no
one ever expected it to be used that way—then you just need to be careful when deleting
data in general.
 
 
Search WWH ::




Custom Search