A fast way to get IDs from GridFS

35 views
Skip to first unread message

Heigler Rocha

unread,
Oct 7, 2013, 10:57:47 PM10/7/13
to mong...@googlegroups.com
Hello,
I'm using GridFS to store small images (10kb ~ 20kb each), i've stored almost 15k of images, however i got a bad performance when tried to find them with "get_last_version(filename)" from my Document instance.

I'm using Flask, so i've created a view to render images by a given ObjectId, that's pretty fast, the slower process is when i try to get the ObjectId using get_last_version.

I tried to use metadata also (indexed) using the doc's ObjectId, but the query were still slow, so i created a new field at my doc called "image_id", when i save the image in GridFS i also save its ID at the Document, my query is now pretty fast, but i feel that's not the right thing to do...

My question is: Is there another better approach to get file's ids from an Document instead get_last_version or get_version?

(sorry for any english mistakes)

Nicolas Clairon

unread,
Oct 8, 2013, 9:59:02 AM10/8/13
to mong...@googlegroups.com
Hi,

This seems to be a pymongo related issue. Have you test with a pymongo only ? If you get the same performance issue with pymongo, you should ask directly on the mongodb's mailing list.

N.


--
 
---
You received this message because you are subscribed to the Google Groups "MongoKit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongokit+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Heigler Rocha

unread,
Oct 8, 2013, 12:46:29 PM10/8/13
to mong...@googlegroups.com
Yes, the same happened with pymogo =/
I'll ask there, maybe i'm just missing something.
Thank you.
Reply all
Reply to author
Forward
0 new messages