Change in $in query behaviour 2.6.1-rc0/php 1.5.x

170 views
Skip to first unread message

Tim Hawkins

unread,
Apr 23, 2014, 11:31:41 PM4/23/14
to mongod...@googlegroups.com
I noticed a change in behaviour in one of my apps running on a dev server that we keep up to date with all the latest versions to track impacts

one page that has always worked on previous versions started to show the following error. 

Message : database:27017: Can't canonicalize query: BadValue $in needs an array

This was caused by a array of values being passed to a  $in query where one of the array elements had resolved to a null. ie. 

$hCollection->find(
                                  array( 
                                              'element'=>array(
                                                     '$in' => array( 
                                                             'option1',
                                                             'option2',
                                                             null
                                                             'option3'
                                                       )
                                               )
                               );

This was silently ignored in i believe in 2.4.x.  in our case it was a benign bug in the code at our end that created the array with the null entry in it, but it had not shown up as an error until moving to 2.6.1-rc0.

Has anybody else seen this? 


Asya Kamsky

unread,
Apr 27, 2014, 11:56:11 PM4/27/14
to mongodb-user
Are you sure that's what caused it?

I just tried it:
db.inter.find({owner:{$in:[1,null,2 ]} })

no problem...

It's actually PHP driver discussed here https://jira.mongodb.org/browse/PHP-1051 and it looks like it's an old "won't fix" https://jira.mongodb.org/browse/PHP-104 as you can see more of a quirkiness of PHP than the server...

Asya






--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAEbsasTUKivT094jttaoYkHfRAp8Sday12E2p3qpcyf8Bp2xkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages