PHP Mongo查询NOT NULL [英] PHP Mongo Query NOT NULL

查看:74
本文介绍了PHP Mongo查询NOT NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道编写php-mongo查询以使用NOT NULL的语法吗?

Anyone know the syntax for writing a php-mongo query to use NOT NULL?

当我查询NULL时,我知道该怎么做:

I know how to do this when I query for NULL:

<?php
$cursor = $collection->find(array("someField" => null));

这有可能吗?

推荐答案

是的,您需要$ne运算符,所以

Yeah, you want the $ne operator, so

$cursor = $collection->find(array("someField" => array('$ne' => null)));

这篇关于PHP Mongo查询NOT NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆