PHP driver is lacking some functions/parameters

12 views
Skip to first unread message

halfdan

unread,
Aug 24, 2010, 7:20:03 PM8/24/10
to mongodb-dev
The PHP driver is not supporting all functions/parameters provided by
the mongo shell, e.g.:

Optional Parameter:

MongoDB::setProfilingLevel(int $level)
http://www.php.net/manual/en/mongodb.setprofilinglevel.php
Shell: db.setProfilingLevel(level, <slowms>)

Missing Function(s):

db.stats()
db.serverStats()
db.collection.findAndModify( { update : ... , remove : bool [, query:
{}, sort: {}, 'new': false] } )
db.collection.renameCollection( newName, <dropTarget> )
db.collection.stats()

Some of them are composites but it would be nice to have them
implemented as object method. Are there any plans on implementing/
extending these methods in the driver in near future?

While writing a small UI for Mongo it was becoming quite hard to
handle authentication as there is no direct way of determining if the
database requires authentication. It would help to have a
MongoDB::requiresAuthentication() method with which one can tell if
the database requires auth.

./halfdan

Kristina Chodorow

unread,
Aug 24, 2010, 7:32:20 PM8/24/10
to mongo...@googlegroups.com
You can construct these using the PHP driver:

$db->command(array("profile" => $level, "slowms" => $ms));

You can usually see what a wrapper function is doing by running it without the ()s:

> db.setProfilingLevel
function (level, slowms) {
    if (level < 0 || level > 2) {
        throw {dbSetProfilingException: "input level " + level + " is out of range [0..2]"};
    }
    var cmd = {profile: level};
    if (slowms) {
        cmd.slowms = slowms;
    }
    return this._dbCommand(cmd);
}


Those are mostly administrative functions, so I don't want to add them to driver proper.  However, if someone wanted to make a MongoDB admin PEAR package or something that wrapped a bunch of administrative functions, that would be really cool (and useful to people making tools).

You could probably use the getCmdLineOpts command to see if the server was started with authentication on. AFAIK there's no more elegant way. 




--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To post to this group, send email to mongo...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-dev?hl=en.


Justin Dearing

unread,
Aug 24, 2010, 7:43:40 PM8/24/10
to mongodb-dev
On Tue, Aug 24, 2010 at 7:32 PM, Kristina Chodorow <kris...@10gen.com> wrote:
You could probably use the getCmdLineOpts command to see if the server was started with authentication on. AFAIK there's no more elegant way.  

There should be a more elegant way. I'm gonna file a ticket in a few minutes. The internet has ~20 minutes  to argue over the function name.

I propose authEnabled().

Justin
 

Justin Dearing

unread,
Aug 24, 2010, 8:07:57 PM8/24/10
to mongodb-dev

halfdan

unread,
Aug 24, 2010, 8:37:03 PM8/24/10
to mongodb-dev
Thank. That would help a lot if implemented.

On Aug 25, 2:07 am, Justin Dearing <zippy1...@gmail.com> wrote:
> http://jira.mongodb.org/browse/SERVER-1677
>
> <http://jira.mongodb.org/browse/SERVER-1677>Vote if you agree.
>
> Justin
>
> On Tue, Aug 24, 2010 at 7:43 PM, Justin Dearing <zippy1...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages