PHP distinct with query parameter

213 views
Skip to first unread message

Sam

unread,
Dec 8, 2009, 2:39:35 PM12/8/09
to mongodb-user
Hi all,

What is the syntax for using the 'distinct' database command along
with a query (PHP driver)?

In the following example, the query parameter doesn't filter any
records (distinct runs on entire collection):

$sns = array('100, '200');
$test = $db->command(array('distinct' => 'testcollection', 'key' =>
'testkey', 'query' => array('sn' => array('$in' => $sns))));

Thanks in advance.

Sam

Kristina Chodorow

unread,
Dec 8, 2009, 3:59:41 PM12/8/09
to mongod...@googlegroups.com
At the moment, you can't.  This will be fixed in the next release (scheduled for the 17th).



--

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.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.



Kristina Chodorow

unread,
Dec 8, 2009, 4:49:48 PM12/8/09
to mongod...@googlegroups.com
If you download the latest code from Github (http://github.com/mongodb/mongo-php-driver) the example you gave should work.

Sam

unread,
Dec 14, 2009, 1:32:51 PM12/14/09
to mongodb-user
Hi Kristina,

Is the next PHP driver release still scheduled for 12/17? If so,
I will just wait until then, thanks.

Sam

On Dec 8, 12:59 pm, Kristina Chodorow <krist...@10gen.com> wrote:
> At the moment, you can't.  This will be fixed in the next release (scheduled
> for the 17th).
>
> On Tue, Dec 8, 2009 at 2:39 PM, Sam <lovable...@gmail.com> wrote:
> > Hi all,
>
> >    What is the syntax for using the 'distinct' database command along
> > with a query (PHP driver)?
>
> >    In the following example, the query parameter doesn't filter any
> > records (distinct runs on entire collection):
>
> > $sns = array('100, '200');
> > $test = $db->command(array('distinct' => 'testcollection', 'key' =>
> > 'testkey', 'query' => array('sn' => array('$in' => $sns))));
>
> >     Thanks in advance.
>
> > Sam
>
> > --
>
> > 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<mongodb-user%2Bunsu...@googlegroups.com>
> > .

Kristina Chodorow

unread,
Dec 14, 2009, 1:46:42 PM12/14/09
to mongod...@googlegroups.com
Yes, on schedule.


To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages