Git Product home page Git Product logo

horn-of-mongo's People

Contributors

nlloyd avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

horn-of-mongo's Issues

BinData round trip data mismatch

db.test.insert({"a":new BinData(0,"iVBORw0K")})

db.test.find()
{ "_id" : ObjectId("51af9949a7d28cd7e29ec528"), "a" : BinData(0,"aVZCT1J3MEs=") }
Result: The binary data became BinData(0,"aVZCT1J3MEs=")

Likely issue with BSONizer.

Cannot create basic types without the "new" keyword

Cannot create basic types without the "new" keyword, official shell permits this.

/* For function Timestamp() */;

var s=Timestamp()
s
[object]
print(s)
TypeError: Cannot find default value for object.
/* For function ObjectId() /;
var d = ObjectId()
d
[object]
print(d)
TypeError: Cannot find default value for object.
/
For function NumberLong() */;
var i=NumberLong(1)
i
[object]
print(i)
NumberLong(1)

adaptor Mongo toString() does not work as expected

Details received by email copy-pasted below:

If you execute/evaluate the string " new Mongo('127.0.0.1:27017')" in our shell, you get ...

new Mongo('127.0.0.1:27017')
connection to null

Looks like mongo.js has the method ...

Mongo.prototype.toString = function(){
return "connection to " + this.host;
}

But the Mongo class does not have a "host" member. Should it have one?

Also, if I put a breakpoint in the Mongo() constructor, then evaluate the string above, it will call the constructor twice, once with the innerMongo object and the other with the string provided. Is that a problem?

When the innerMongo object is provided, should the if/else block for this also set the "hosts" member? Like this ...

    else if (host instanceof com.mongodb.Mongo) {
        this.innerMongo = (com.mongodb.Mongo) host;
        this.hosts = innerMongo.getServerAddressList();
    } else if (host instanceof List<?>)

clear, exit, quit redirection to interfaced Handlers

clear
ReferenceError: "clear" is not defined.
exit
ReferenceError: "exit" is not defined.
quit
function quit() {
[native code, arity=1]
}

Basically: do what PrintHandler interface does for print(...), but now add 3 others.

Disconnected MongoScope Connection Problem

Hi, I'm trying to connect to a local mongo instance using the Disconnected MongoScope method and the call to MongoRuntime.call() is throwing a syntax error exception when I use a password with special characters, e.g., "?" and "~". If I start mongod without using the "--auth" option and remove user/pass from the connection string in the call to new MongoScriptAction(), everything works as expected. The error appears to be in the call to the cx.evaluateString method inside MongoScriptAction.doRun method.

Any help is appreciated, thanks.

Multiple MongoScope instances in a single JVM/Context are not supported due to custom prototype handling.

ScriptableMongoObject overrides the default "prototype" behavior by using a static registry to store the prototype for each ScriptableMongoObject. Effectively all instances of the same object type share the same prototype. However, when various javascript objects are compiled, they contain a reference to the MonoScope object. Thus the objects in each prototype are tied to a certain MonoScope. Because of this, this implementation does not properly support the use of multiple MongoScope.

In order to be able to support multiple "shells" within 1 JVM, there needs to be a separate prototype registry per MongoScope or per "context". However, one complication is that the first call to ScriptableMongoObject.getPrototype(), right after an object instance is created, the "mongoScope" variable is null.

Implement help and show key words.

The following features are missing:
(in the official mongo shell)

help
... print out of help data
show dbs
... show databases in current instance/cluster
show collections
... show collections in current db

slf4j implementation of PrintHandler

For better integration with projects that use a logging framework there should be a ready-to-go PrintHandler implementation using slf4j for maximum compatibility across logging frameworks in the Java space.

Implement native system calls

Functionality available in the mongo shell but TODO in horn-of-mongo:

help admin
ls([path]) list files
pwd() returns current directory
listFiles([path]) returns file list
hostname() returns name of this host
cat(fname) returns contents of text file as a string
removeFile(f) delete a file or directory
load(jsfilename) load and execute a .js file
run(program[, args...]) spawn a program and wait for its completion
runProgram(program[, args...]) same as run(), above
sleep(m) sleep m milliseconds
getMemInfo() diagnostic

getHostName()
ReferenceError: "getHostName" is not defined.
getMemInfo()
ReferenceError: "getMemInfo" is not defined.
hostname()
ReferenceError: "hostname" is not defined.
listFiles()
ReferenceError: "listFiles" is not defined.

db.runCommand() with no such command does not behave as expected

db.runCommand('Customers');
{
"serverUsed" : "/10.168.11.47:27017",
"ok" : 0,
"errmsg" : "no such cmd: Customers",
"bad cmd" : {
"Customers" : 1
}
}
db.runCommand();
Wrapped java.util.NoSuchElementException (mongodb/query.js#77)
db.getCollection("$cmd").findOne()
Wrapped java.util.NoSuchElementException (mongodb/query.js#77)

The db.runCommand() doesn't return a result the way the Mongo CLI does. It calls Mongo.find() at line 163 which throws an exception because DB.command():74 calls :

String comString = command.keySet().iterator().next();

Which throws NoSuchElementException.

horn-of-mongo not compatible with mongodb 3

Hi Nick,

I've produced a fork that works with rhino 1.7.7 and mongo-java-driver 3.1.0.
Would you be interested in considering these changes for a new release of h-o-m?

Thanks,

Gerald.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.