Skip to content

Commit

Permalink
make some js stuff use table scan helper
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Dec 3, 2009
1 parent 5d8ca55 commit 843f365
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions db/client.h
Expand Up @@ -24,6 +24,8 @@

#pragma once

#include "stdafx.h"
#include "namespace.h"
#include "lasterror.h"
#include "../util/top.h"

Expand Down
7 changes: 7 additions & 0 deletions db/dbhelpers.h
Expand Up @@ -22,8 +22,15 @@

#pragma once

#include "stdafx.h"
#include "client.h"
#include "dbinfo.h"
#include "db.h"

namespace mongo {

class Cursor;

class CursorIterator {
public:

Expand Down
12 changes: 7 additions & 5 deletions scripting/engine.cpp
Expand Up @@ -19,6 +19,8 @@
#include "engine.h"
#include "../util/file.h"
#include "../client/dbclient.h"
#include "../db/dbinfo.h"
#include "../db/dbhelpers.h"

namespace mongo {

Expand Down Expand Up @@ -132,11 +134,10 @@ namespace mongo {

_loadedVersion = _lastVersion;

static DBClientBase * db = createDirectClient();

auto_ptr<DBClientCursor> c = db->query( _localDBName + ".system.js" , Query() );
while ( c->more() ){
BSONObj o = c->next();
string coll = _localDBName + ".system.js";
auto_ptr<CursorIterator> i = Helpers::find( coll.c_str() );
while ( i->hasNext() ){
BSONObj o = i->next();

BSONElement n = o["_id"];
BSONElement v = o["value"];
Expand All @@ -146,6 +147,7 @@ namespace mongo {

setElement( n.valuestr() , v );
}

}

ScriptingFunction Scope::createFunction( const char * code ){
Expand Down

0 comments on commit 843f365

Please sign in to comment.