There are two fields 'first', 'second', do not advise how to compare them in the collection 'collection'. To output only those records where first does not equal second. Mongodb 3.0

    1 answer 1

    db.collection.find({$where: function(){ return obj.first !== obj.second} }) 
    • $ Query = $ collection-> find (array ('foreignKey' => new MongoId ($ foreignkey, 'first' => array ('$ exist' => true), '$ where' => function () {return ' first '! ==' second ';})); - Dmitry Ignatov
    • In this syntax for php how to remake? - Dmitry Ignatov
    • I do not know. This is the syntax for mongo-shell - Dmytryk February