summaryrefslogtreecommitdiff
path: root/jstests/eval1.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-02-15 16:12:54 -0500
committerEliot Horowitz <eliot@10gen.com>2009-02-15 16:12:54 -0500
commit566af4dc73e74e2f0b5a566455d82319ec312537 (patch)
tree304508688a326e02e494260ad6ba4d66173a0e58 /jstests/eval1.js
parentb4a918ff94d8828240fd89e4f82bfe493f932374 (diff)
downloadmongo-566af4dc73e74e2f0b5a566455d82319ec312537.tar.gz
new java js system
Diffstat (limited to 'jstests/eval1.js')
-rw-r--r--jstests/eval1.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/eval1.js b/jstests/eval1.js
new file mode 100644
index 00000000000..4c5fe3d283f
--- /dev/null
+++ b/jstests/eval1.js
@@ -0,0 +1,16 @@
+
+t = db.eval1;
+t.drop();
+
+t.save( { _id : 1 , name : "eliot" } );
+t.save( { _id : 2 , name : "sara" } );
+
+f = function(id){
+ return db["eval1"].findOne( { _id : id } ).name;
+}
+
+
+assert.eq( "eliot" , f( 1 ) );
+assert.eq( "sara" , f( 2 ) );
+assert.eq( "eliot" , db.eval( f , 1 ) );
+assert.eq( "sara" , db.eval( f , 2 ) );