0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/basic9.js

26 lines
407 B
JavaScript

t = db.getCollection( "foo" );
t.save( { "foo$bar" : 5 } );
ok = false;
try{
t.save( { "$foo" : 5 } );
ok = false;
}
catch ( e ){
ok = true;
}
assert( ok , "key names aren't allowed to start with $ doesn't work" );
try{
t.save( { "x" : { "$foo" : 5 } } );
ok = false;
}
catch ( e ){
ok = true;
}
assert( ok , "embedded key names aren't allowed to start with $ doesn't work" );