Problems with Db#eval method

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      OS: Debian linux, mongodb version 1.2.1 mongo and mongo_ext gems version: 0.18.3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Trying to automate creating and deleting mongo database and user for it.
      Got a problem with such code:

      conn = Mongo::Connection.new("localhost")
      conn.db("admin").authenticate("root", "password")
      conn.db("foobar").eval("db.addUser()", "foo", "bar")

      /var/lib/gems/1.8/gems/mongo-0.18.3/lib/../lib/mongo/db.rb:293:in `eval': eval failed: invoke failed: JS Error: ReferenceError: hex_md5 is not defined (anon):42 (Mongo::OperationFailure)
      from ./test-mongo.rb:15

      Some another evaluations from ruby script works, like:
      conn.db("some_base").eval("db.dropDatabase()")

      I sepose it's error from mongodb, but same evaluations in mongo shell works
      use foobar;
      db.addUser("foo", "bar")

      Is this a bug or is there an another way to create mongodb user from ruby script?

            Assignee:
            Kyle Banker (Inactive)
            Reporter:
            Anton A. Vesnin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: