Skip to content

Commit

Permalink
readme update for gfsIndexes/0,1
Browse files Browse the repository at this point in the history
  • Loading branch information
SergejJurecko committed Aug 11, 2010
1 parent 454c929 commit 117dd11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand Down Expand Up @@ -145,6 +147,7 @@ DB
* getProfilingLevel

GridFS
* gdsIndexes
* gfsNew
* gfsWrite
* gfsOpen
Expand Down
4 changes: 4 additions & 0 deletions mongoapi.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 117dd11

Please sign in to comment.