Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:mongodb/mongo
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Nov 24, 2009
2 parents 0254bf6 + 76469ff commit de1b595
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
11 changes: 7 additions & 4 deletions SConstruct
Expand Up @@ -631,10 +631,13 @@ def add_exe(target):
def setupBuildInfoFile( outFile ):
version = getGitVersion()
sysInfo = getSysInfo()
contents = "#include \"stdafx.h\"\n"
contents += "#include <iostream>\n"
contents += "namespace mongo { const char * gitVersion(){ return \"" + version + "\"; } }\n"
contents += "namespace mongo { const char * sysInfo(){ return \"" + sysInfo + "\"; } }\n"
contents = '\n'.join([
'#include "stdafx.h"',
'#include <iostream>',
'#include <boost/version.hpp>',
'namespace mongo { const char * gitVersion(){ return "' + version + '"; } }',
'namespace mongo { const char * sysInfo(){ return "' + sysInfo + ' BOOST_LIB_VERSION=" BOOST_LIB_VERSION ; } }',
])

if os.path.exists( outFile ) and open( outFile ).read().strip() == contents.strip():
return
Expand Down
21 changes: 21 additions & 0 deletions jstests/sort5.js
@@ -0,0 +1,21 @@
var t = db.sort5;
t.drop();

t.save({_id: 5, x: 1, y: {a: 5, b: 4}});
t.save({_id: 7, x: 2, y: {a: 7, b: 3}});
t.save({_id: 2, x: 3, y: {a: 2, b: 3}});
t.save({_id: 9, x: 4, y: {a: 9, b: 3}});

// test compound sorting

assert.eq( [4,2,3,1] , t.find().sort({"y.b": 1 , "y.a" : -1 }).map( function(z){ return z.x; } ) , "A no index" );
t.ensureIndex({"y.b": 1, "y.a": -1});
assert.eq( [4,2,3,1] , t.find().sort({"y.b": 1 , "y.a" : -1 }).map( function(z){ return z.x; } ) , "A index" );
assert(t.validate().valid, "A valid");

// test sorting on compound key involving _id

// assert.eq( [4,2,3,1] , t.find().sort({"y.b": 1 , _id : -1 }).map( function(z){ return z.x; } ) , "B no index" );
// t.ensureIndex({"y.b": 1, "_id": -1});
// assert.eq( [4,2,3,1] , t.find().sort({"y.b": 1 , _id : -1 }).map( function(z){ return z.x; } ) , "B index" );
// assert(t.validate().valid, "B valid");

0 comments on commit de1b595

Please sign in to comment.