Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
56 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
git clone git://github.com/10gen/mongo | ||
cd mongo/db | ||
|
||
sudo port install boost pcre++ | ||
|
||
for i in system thread filesystem; do | ||
sudo ln -s /opt/local/lib/libboost_${i}-mt.dylib /opt/local/lib/libboost_${i}.dylib | ||
done | ||
|
||
make clean | ||
make CFLAGS="-I/opt/local/include -L/opt/local/lib -lboost_system" | ||
|
||
mkdir /tmp/data | ||
sudo ./db run --nojni --dbpath /tmp/data |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,57 @@ | ||
package mongo.ruby; | ||
|
||
import java.util.*; | ||
|
||
import ed.js.*; | ||
import ed.js.func.*; | ||
import ed.js.engine.*; | ||
import ed.db.*; | ||
|
||
public class Mongo extends DBBase { | ||
|
||
private Map<String,DBCollection> _collections = new TreeMap<String,DBCollection>(); | ||
|
||
public class Mongo { | ||
public Mongo(){ | ||
super("Mongo"); | ||
} | ||
|
||
protected DBCollection doGetCollection( String name ){ | ||
DBCollection c = _collections.get( name ); | ||
if ( c == null ){ | ||
c = new MongoCollection( this, name ); | ||
_collections.put( name, c ); | ||
} | ||
return c; | ||
} | ||
|
||
public DBCollection getCollectionFromFull( String fullNameSpace ){ | ||
throw new RuntimeException( "not implemented" ); | ||
} | ||
|
||
public Collection<String> getCollectionNames(){ | ||
return Collections.unmodifiableSet( _collections.keySet() ); | ||
} | ||
|
||
public String getConnectPoint(){ | ||
return null; | ||
} | ||
|
||
class MongoCollection extends DBCollection { | ||
protected MongoCollection(DBBase base, String name) { | ||
super(base, name); | ||
} | ||
|
||
protected JSObject doSave(JSObject arg0) { | ||
return null; | ||
} | ||
|
||
protected void doapply(JSObject arg0) { | ||
} | ||
|
||
protected JSObject dofind(ObjectId arg0) { | ||
return null; | ||
} | ||
|
||
public void ensureIndex(JSObject arg0, String arg1) { | ||
} | ||
|
||
public Iterator<JSObject> find(JSObject arg0, JSObject arg1, int arg2, int arg3) { | ||
return null; | ||
} | ||
DBApiLayer db = DBProvider.get("mongo"); | ||
DBCollection test = db.getCollection("test"); | ||
|
||
public int remove(JSObject arg0) { | ||
return 0; | ||
} | ||
JSObjectBase obj = new JSObjectBase(); | ||
obj.set("name", "mongo"); | ||
test.save(obj); | ||
|
||
public JSObject update(JSObject arg0, JSObject arg1, boolean arg2, boolean arg3) { | ||
return null; | ||
JSObjectBase query = new JSObjectBase(); | ||
query.set("name", "mongo"); | ||
for (Iterator<JSObject> it = test.find(query); it.hasNext(); ){ | ||
JSObject o = it.next(); | ||
System.out.println("got result _id: " + o.get("_id").toString()); | ||
System.out.println("got result name: " + o.get("name").toString()); | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
Mongo db = new Mongo(); | ||
DBCollection test = db.getCollection("test"); | ||
test. | ||
System.out.println("starting.."); | ||
new Mongo(); | ||
System.out.println("done."); | ||
} | ||
|
||
} | ||
} | ||
|
||
/* | ||
$ cat 10gen.properties | ||
BASE=~/code/10gen/appserver/libraries | ||
$ cat run.sh | ||
#!/bin/sh | ||
CLASSPATH=./bin/:~/code/10gen/appserver/build/; for i in ~/code/10gen/appserver/include/*.jar; do CLASSPATH=$CLASSPATH:$i; done; ED_HOME=~/code/10gen/appserver java -cp $CLASSPATH mongo.ruby.Mongo | ||
$ ./run.sh | ||
starting.. | ||
loading config file from [./10gen.properties] | ||
DBApiLayer : DBTCP : 127.0.0.1:27017/mongo | ||
Warning : can't find core appserver js sources : no harm, but js will be recompiled on appserver startup | ||
got result _id: 488c4d40771f9ab200645c9d | ||
got result name: mongo | ||
got result _id: 488c4d4f771f9af10025c852 | ||
got result name: mongo | ||
got result _id: 488c4fd4771f9ac9006002b5 | ||
got result name: mongo | ||
got result _id: 488c4fdd771f9aee00d0fe71 | ||
got result name: mongo | ||
done. | ||
*/ |
This file was deleted.
Oops, something went wrong.