forked from jkvor/emongo
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from AF83/bson_null
Bson value null
- Loading branch information
Showing
9 changed files
with
49 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
#!/usr/local/bin/escript | ||
#!/usr/bin/env escript | ||
%% -*- erlang -*- | ||
%%! -pa ebin -sasl errlog_type error -boot start_sasl -noshell -config priv/example | ||
|
||
main(_) -> | ||
etap:plan(unknown), | ||
error_logger:tty(false), | ||
etap_application:start_ok(emongo, "application 'emongo' started ok"), | ||
etap:ok(application:start(emongo) == ok, "application 'emongo' started ok"), | ||
|
||
emongo:delete(test1, "sushi"), | ||
etap:is(emongo:find_all(test1, "sushi"), [], "sushi collection is empty"), | ||
|
||
[emongo:insert(test1, "sushi", [{<<"rolls">>, I}]) || I <- lists:seq(1, 50)], | ||
|
||
(fun() -> | ||
emongo:update(test1, "sushi", [{<<"rolls">>, [{gt, 45}]}], [{<<"$set">>, [{<<"rolls">>, 100}]}], false, true), | ||
Docs = emongo:find_all(test1, "sushi", [{<<"rolls">>, 100}], []), | ||
etap:is(length(Docs), 5, "correct number of results after multiupdate"), | ||
etap:is([I || [_, {_, I}] <- Docs], [100,100,100,100,100], "correct results after multiupdate"), | ||
ok | ||
emongo:update(test1, "sushi", [{<<"rolls">>, [{gt, 45}]}], [{<<"$set">>, [{<<"rolls">>, 100}]}], false, true), | ||
Docs = emongo:find_all(test1, "sushi", [{<<"rolls">>, 100}], []), | ||
etap:is(length(Docs), 5, "correct number of results after multiupdate"), | ||
etap:is([I || [_, {_, I}] <- Docs], [100,100,100,100,100], "correct results after multiupdate"), | ||
ok | ||
end)(), | ||
|
||
etap:end_tests(). |