Browse files

readme update for gfsIndexes/0,1

  • Loading branch information...
1 parent 454c929 commit 117dd11a3d247be599e74b978df0b6323481b4d1 @SergejJurecko committed Aug 11, 2010
Showing with 7 additions and 0 deletions.
  1. +3 −0 README.rdoc
  2. +4 −0 mongoapi.erl
View
3 README.rdoc
@@ -94,6 +94,8 @@ Connection info is saved in an application variable (erlmongo,connections) and u
Mong:runCmd([{"findandmodify", "collectionname"},{"query", [{"fn","onmeta.flv"},{"ch","somechan"}]},{"remove",1}]).
% GridFS
+ % Always run this on collection before writing the first file
+ Mong:gfsIndexes().
{ok, Bin} = file:read_file("SomeFile").
% To open file for writing, use gfsNew
PID = Mong:gfsNew("myfile").
@@ -145,6 +147,7 @@ DB
* getProfilingLevel
GridFS
+* gdsIndexes
* gfsNew
* gfsWrite
* gfsOpen
View
4 mongoapi.erl
@@ -454,6 +454,9 @@ setProfilingLevel(L) when is_integer(L) ->
getProfilingLevel() ->
runCmd([{"profile", -1}]).
+%
+% Run this before writing any files, or writing will fail!
+%
gfsIndexes() ->
gfsIndexes(<<"fd">>).
gfsIndexes(Collection) ->
@@ -558,6 +561,7 @@ testw(Mong, Filename) ->
% Both calls will complete before gfs gets the chance to set trap_exit to true and detect
% the caller has died.
{ok,Bin} = file:read_file(Filename),
+ Mong:gfsIndexes(),
PID = Mong:gfsNew(Filename),
Mong:gfsWrite(PID,Bin),
Mong:gfsClose(PID)

0 comments on commit 117dd11

Please sign in to comment.