How do I remove all documents in a collection where a field’s value isn’t null? Basically the MySql query version would be like this:
// MySql query
DELETE FROM companies WHERE createdBy != NULL
// What I tried but did not work.
$this->mongo->companies->remove(array('createdBy' => true));
I don’t even know if it is possible, if anyone could help me with this I would appreciate it 😉
Thanks 🙂
You can do it easy via not equal operator: