Permalink
Browse files

make some js stuff use table scan helper

  • Loading branch information...
1 parent 5d8ca55 commit 843f365571571a8b154dd029eb770b15c9953010 @erh erh committed Dec 3, 2009
Showing with 16 additions and 5 deletions.
  1. +2 −0 db/client.h
  2. +7 −0 db/dbhelpers.h
  3. +7 −5 scripting/engine.cpp
View
@@ -24,6 +24,8 @@
#pragma once
+#include "stdafx.h"
+#include "namespace.h"
#include "lasterror.h"
#include "../util/top.h"
View
@@ -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:
View
@@ -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 {
@@ -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"];
@@ -146,6 +147,7 @@ namespace mongo {
setElement( n.valuestr() , v );
}
+
}
ScriptingFunction Scope::createFunction( const char * code ){

0 comments on commit 843f365

Please sign in to comment.