[JAVA-389] Make GridFS index check/ensure less costly Created: 29/Jun/11  Updated: 02/Sep/15  Resolved: 02/Sep/15

Status: Closed
Project: Java Driver
Component/s: GridFS
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Trivial - P5
Reporter: Scott Hernandez (Inactive) Assignee: Unassigned
Resolution: Won't Fix Votes: 1
Labels: gridfs
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by JAVA-1938 Drive counts fs.chunks and fs.files e... Closed

 Description   

Add a check for the index (doesn't require a server call if cached) before calling count (always requires a server call).



 Comments   
Comment by Ross Lawley [ 02/Sep/15 ]

There is a new GridFS implementation JAVA-1713 that follows the new GridFS specification with regards to how to check for and create indexes on a GridFS Bucket.

Comment by Thilo Planz [ 30/Nov/11 ]

It should not be necessary to make the GridFS instance a singleton just for this.

Also, not everyone may need an index on filename, right? Ideally it should be left to the user to create the indexes he wants, and not happen automatically (and least of all as part of a constructor).

If that is too big a change, then there should be a new optional flag for the constructor to not have the count/index check, and if the count does need to be run (after the fix discussed here), maybe the count could be executed with a limit of 1000 so that it returns quickly even on large collections?

Comment by Scott Hernandez (Inactive) [ 19/Jul/11 ]

yes, it will be have to checked once, but if you don't create the GridFS as a singleton then it may do needless calls.

Comment by Antoine Girbal [ 19/Jul/11 ]

hopefully the GridFS instance is a singleton.
So if created at beginning of app, the index would need to be checked against server anyway, right?

Generated at Thu Feb 08 08:52:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.