0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/index6.js
2009-01-26 23:28:26 -05:00

10 lines
257 B
JavaScript

// index6.js Test indexes on array subelements.
db = connect( "test" );
r = db.ed.db.index5;
r.drop();
r.save( { comments : [ { name : "eliot", foo : 1 } ] } );
r.ensureIndex( { "comments.name": 1 } );
assert( r.findOne( { "comments.name": "eliot" } ) );