You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depending on how MongoDBFactory is implemented, each call to it could potentially return a different DB instance every time, so the big question basically becomes on what scope to cache the GridFS instance. To be completely honest, I wasn't expecting the constructor to issue database calls in the first place.
We could of course go ahead and keep GridFS instances around per Db but I am kind of wondering wha implications this has for the resources we keep alive by that (the DBCollection instances within GridFS instances etc.).
Now I know that why 'new GridFS' every time. But because of this, we will call :
{ "count" : "fs.files", "query" : { } }}
{ "count" : "fs.chunks", "query" : { } }}
before each 'find(), store(), delete()', I just expecting to reduce the two query. ^_^
This caused count all 'files' and 'chunks' collections before invoke 'find(), store(), delete()' every time! It is so bad!!
I am looking forward to fix it! Thank you!
Derek opened DATAMONGO-1441 and commented
Why create GridFS(new GridFS) everytime?
In GridFS constructor, " filesCollection.count() ,chunksCollection.count()" excute everytime
Affects: 1.8.4 (Gosling SR4), 1.9.1 (Hopper SR1), 1.8.6 (Gosling SR6), 1.9.5 (Hopper SR5), 1.10 GA (Ingalls)
Reference URL: https://github.com/spring-projects/spring-data-mongodb/blob/master/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java
The text was updated successfully, but these errors were encountered: