2015-11-15

MongoDB - Filter on a couple of fields (simple and using $and:[])

db.COLLECTION_NAME.find(
    FIELD_NAME_1 : EXACT_VALUE_TO_COMPARE_TO
    , FIELD_NAME_2 : EXACT_VALUE_TO_COMPARE_TO
);


db.COLLECTION_NAME.find(
    $and: [
        { FIELD_NAME_1 : EXACT_VALUE_TO_COMPARE_TO }
        , { FIELD_NAME_2 : EXACT_VALUE_TO_COMPARE_TO }
    ]
);


No comments:

Post a Comment