New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongeez requires admin privileges #733

Closed
jdubois opened this Issue Nov 4, 2014 · 15 comments

Comments

Projects
None yet
8 participants
@jdubois
Copy link
Member

jdubois commented Nov 4, 2014

Mongeez (used to populate MongoDB) does not work on cloud providers like https://mongolab.com/ as it requires admin privileges.
See mongeez/mongeez#27

We might consider another option soon, as this is a blocker issue with CloudFoundry + Mongodb, which would be a great combo!

@pvlastaridis

This comment has been minimized.

Copy link
Member

pvlastaridis commented Nov 5, 2014

There is a mongeez.setAuth method here https://github.com/secondmarket/mongeez/blob/master/src/main/java/org/mongeez/Mongeez.java

But I don't know if this could be of any help? You can at least try it out.

@jmirc

This comment has been minimized.

Copy link
Member

jmirc commented Nov 5, 2014

The problem is related to the use of the eval method that requires admin access.

@jdubois

This comment has been minimized.

Copy link
Member Author

jdubois commented Dec 23, 2014

I'm putting this as "won't fix" and updating the documentation -> this is a limitation as long as we use Mongeez. I guess we should move to another solution.

@d0x

This comment has been minimized.

Copy link

d0x commented Aug 20, 2015

Do you have a plan to move to another solution?

@jdubois

This comment has been minimized.

Copy link
Member Author

jdubois commented Aug 20, 2015

Yes I want to use another solution. I just haven't worked on it yet -> if you are interested you can take the lead on this!

@franciscocpg

This comment has been minimized.

Copy link

franciscocpg commented Sep 9, 2015

@jdubois
I think the solution here is not to use another solution, but to patch Mongeez because the problem here is just the following code at MongeezDao.java:

public void runScript(String code) {
        db.eval(code);
}

Besides the fact that eval requires admin privileges, it was deprecated in version 3.0 and future releases will remove it according to this thread:
https://jira.mongodb.org/browse/SERVER-17453
I see two options at this moment:

  1. Instead of writing javascript codes in mongeez changesets xml file, should write java code and execute it using bsh.
  2. Parse javascript code and create a wrapper for java using mongodb java driver.
    For example:
    The code
db.test.insert({
   "name" : "MongoDB",
   "type" : "database",
   "count" : 1,
   "info" : {
               x : 203,
               y : 102
             }
})

should execute

DBCollection testCollection = db.getCollection("test");
BasicDBObject doc = new BasicDBObject("name", "MongoDB")
        .append("type", "database")
        .append("count", 1)
        .append("info", new BasicDBObject("x", 203).append("y", 102));
testCollection.insert(doc);

For this option, maybe some project like jongo could help.

@rreitmann

This comment has been minimized.

Copy link

rreitmann commented Nov 10, 2015

Is there any workaround at the moment? I also want to deploy to cloudfoundry (Pivotal Web Services) using mongodb...

@jdubois

This comment has been minimized.

Copy link
Member Author

jdubois commented Nov 11, 2015

The only workaround is to update the database manually.

@rreitmann

This comment has been minimized.

Copy link

rreitmann commented Nov 11, 2015

:-) This is exactly what I am doing currently.

@rreitmann

This comment has been minimized.

Copy link

rreitmann commented Nov 11, 2015

I guess I will have a look at this https://github.com/goodeggs/grunt-mongo-migrations and manage the mongo migrations with mongoose...

@jdubois

This comment has been minimized.

Copy link
Member Author

jdubois commented Nov 11, 2015

Yes I've heard it could be a good solution : please send feedback, and even a PR if you can !

@hyuan

This comment has been minimized.

Copy link
Contributor

hyuan commented Nov 25, 2015

I think @franciscocpg's suggestion one - use bsh to write scripts - is doable. I submitted a PR mongeez/mongeez#55 to mongeez

@franciscocpg

This comment has been minimized.

Copy link

franciscocpg commented Nov 27, 2015

@hyuan, great news! But I think mongeez is a little bit "inactive". The last appoved PR was on 4 Aug 2014 and the last closed was on 12 May 2015.
Let's pray for they approved your PR. :)

@sreeshas

This comment has been minimized.

Copy link

sreeshas commented Dec 12, 2015

@jdubois I have an alternative solution for this problem. Instead of using mongeez, i stumbled upon mongobee. I tried it out and it worked as expected.

You can find more details here.
http://sreeshas.github.io/2015/12/10/using-mongolab-in-jhipster/

Let me know if you would like me to submit this fix.

@jdubois

This comment has been minimized.

Copy link
Member Author

jdubois commented Dec 14, 2015

Looks indeed like a better solution, but the project doesn't seem very active either.... And I don't want to have the same kind of issue again. What do people use with MongoDB???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment