forallepsilon
forallepsilon

Reputation: 429

How can I query an FS collection in Meteor from the command line?

It is very useful to run meteor mongo and query collections from the command line, for debugging purposes, etc.

Recently, I have added the collectionFS package to enable image storage in the database. However, I am unable to query the database from the command line.

db.fs.collection_name.find() is not doing the trick, and I can't seem to find the correct command anywhere.

Upvotes: 3

Views: 853

Answers (2)

Greenhorn
Greenhorn

Reputation: 590

If you find it difficult to use the command line or terminal, you have a UI for MongoDB called Robomongo which is easy to install and use. I use Meteor with its default port number and then in Robomongo it is used as 3001.

And the query to view collection here is same as db.collection_name.find().

Upvotes: 1

giantsnyc
giantsnyc

Reputation: 203

Go to the Meteor Mongo console: meteor mongo

See all the collections that are available: show collections

Look for the one that has cfs.collection_name.files

Choose the one that has your collection name. For example, I'm 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 those files.

Hope that helps.

Upvotes: 5

Related Questions