Skip to content

Instantly share code, notes, and snippets.

@trecouvr
Created March 15, 2012 18:56
Show Gist options
  • Save trecouvr/2046026 to your computer and use it in GitHub Desktop.
Save trecouvr/2046026 to your computer and use it in GitHub Desktop.
bug on opa mongodb ?
database test {
int /counter = 0;
stringmap(int) /mymap;
}
function action(_) {
Int.repeat(function (_) {
c = /test/counter
/test/mymap["{c}"] <- c
/test/counter = c + 1
void
}, void, 200);
#msg = <>counter : {/test/counter}!</>;
}
function show_map(_) {
c = Map.fold(function(key,value,acc) {
acc+1;
}, /test/mymap, 0);
#msg_map = <>rows : {c}</>;
}
function page() {
<h1>Hello, world</h1>
<div id="msg">counter : {/test/counter} !</div>
<button onclick={action}>inc 200</button>
<div id="msg_map"></div>
<button onclick={show_map}>show map</button>;
}
Server.start(
Server.http,
{ ~page, title: "Hello, world" }
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment