Preventing certain commands

21 views
Skip to first unread message

coys

unread,
Jul 16, 2012, 2:55:37 PM7/16/12
to mongodb-user
Hello, Is there a way I can configure my mongodb setup so that users
are not allowed to run the remove command? Thanks

Eliot Horowitz

unread,
Jul 16, 2012, 10:22:41 PM7/16/12
to mongod...@googlegroups.com
No, the only options currently are read only users or read/write users.

On Mon, Jul 16, 2012 at 2:55 PM, coys <gaut...@gmail.com> wrote:
> Hello, Is there a way I can configure my mongodb setup so that users
> are not allowed to run the remove command? Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb

coys

unread,
Jul 17, 2012, 11:06:00 AM7/17/12
to mongodb-user
Hi Eloit, thanks for the reply. Btw, I was told about this link where
I can remove the delete and drop table functionality, but this is on
an old version of mongodb..I was just curious if its supported anymore
and if its okay to go ahead with it -
http://books.google.com/books?id=IZiyEX_2JtoC&pg=PA49&lpg=PA49&dq=mongodb+DBCollection.prototype.drop&source=bl&ots=r01tpZCV04&sig=PriIcrWIgDkOdPdbwJVqX7s2haU&hl=en&sa=X&ei=AHwFUNLlK4KK8QTb06z5Bw&ved=0CE4Q6AEwAw#v=onepage&q=mongodb%20DBCollection.prototype.drop&f=false
Thanks!

Grégoire Seux

unread,
Jul 17, 2012, 11:12:18 AM7/17/12
to mongod...@googlegroups.com
This is only a way to remove the helper function in the javascript shell.
If you simply want to avoid mistakes, you can do this and distribute the rc file to all your users. Otherwise, this won't work.

coys

unread,
Jul 17, 2012, 11:26:36 AM7/17/12
to mongodb-user
Thanks!

coys

unread,
Jul 17, 2012, 12:38:58 PM7/17/12
to mongodb-user
Hello, I actually created the following script as explained in the
book ,
startup.js, containing only these 3 lines,
===
delete DBCollection.prototype.drop;
delete DBCollection.prototype.remove;
delete DB.prototype.dropDatabase;
====
However, when I run ./mongo statup.js, it says connecting to test and
exits without giving me the shell. However, when I have a mongo shell
and I load the script,>load("startup.js") it works nicely as expected.
Is there anything I need to add to the script to get it working when I
invoke it as ./mongo startup.js? Thanks!
Reply all
Reply to author
Forward
0 new messages