How can I query the FS collection in Meteor from the command line?
It is very useful to run meteor mongo
collections of queries from the command line, for debugging purposes, etc.
I recently added a package collectionFS
to enable image storage in the database. However, I am unable to query the database from the command line.
db.fs.collection_name.find()
doesn't do the trick and I can't seem to find the correct command anywhere.
source to share
Go to the Meteor Mongo console: meteor mongo
Check out all the collections available: show collections
Look for one that has cfs.collection_name.files
Choose the one that has the name of your collection. For example, I am using collectionFS with gridFS for images. When I type show collections
I see cfs_gridfs.images.files
, so I just do: db.cfs_gridfs.images.files.find()
to see these files.
Hope it helps.
source to share
If you find it difficult to use the command line or terminal, you have a user interface for MongoDB
, called Robomongo , that is easy to install and use. I use Meteor with default port number and then Robomongo uses like 3001
.
And the request to view the collection here is the same as db.collection_name.find()
.
source to share