mongoDB operator

Query Selectors

Comparison

For comparison of different BSON type values, see the specified BSON comparison order.
NameDescription   (a operator b)
$eqMatches values that are equal to a specified value. (a=b   :true)
$gtMatches values that are greater than a specified value. (a>b  :true)
$gteMatches values that are greater than or equal to a specified   value.
(a>=b : true)
$ltMatches values that are less than a specified value. (a<b   :true)
$lteMatches values that are less than or equal to a specified value.   (a<=b   :true)
$neMatches all values that are not equal to a specified value.   (a =!b  :true)
$inMatches any of the values specified in an array.   (b includes a   :true)
$ninMatches none of the values specified in an array. (b doesn't have a   :true)

Logical

NameDescription
$orJoins query clauses with a logical OR returns all documents that match the conditions of either clause.
$andJoins query clauses with a logical AND returns all documents that match the conditions of both clauses.
$notInverts the effect of a query expression and returns documents that do not match the query expression. (쿼리의 결과를 반대로 뒤집고 쿼리조건에 해당하지 않는 document만 반환한다)
$norJoins query clauses with a logical NOR returns all documents that fail to match both clauses. (이 조건에 매치되지 않는 documents만 반환.)

Element

NameDescription
$existsMatches documents that have the specified field.
(특정 field를 갖는 document만 반환)
$typeSelects documents if a field is of the specified type.
(특정 타입의 field를 갖는 document만 반환)

Evaluation

NameDescription
$modPerforms a modulo operation on the value of a field and selects documents with a specified result.
$regexSelects documents where values match a specified regular expression.
특정 정규식에 맞는 documents를 반환함.
$textPerforms text search.
문자열을 검색함.
$whereMatches documents that satisfy a JavaScript expression.
js 식으로 작성한 document를 반환.

Geospatial

NameDescription
$geoWithinSelects geometries within a bounding GeoJSON geometry. The 2dsphere and 2dindexes support $geoWithin.
$geoIntersectsSelects geometries that intersect with a GeoJSON geometry. The 2dsphere index supports $geoIntersects.
$nearReturns geospatial objects in proximity to a point. Requires a geospatial index. The2dsphere and 2d indexes support $near.
$nearSphereReturns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. The 2dsphere and 2d indexes support $nearSphere.

Array

NameDescription
$allMatches arrays that contain all elements specified in the query.
$elemMatchSelects documents if element in the array field matches all the specified $elemMatchconditions.
$sizeSelects documents if the array field is a specified size.

Bitwise

NameDescription
$bitsAllSetMatches numeric or binary values in which a set of bit positions all have a value of 1.
$bitsAnySetMatches numeric or binary values in which any bit from a set of bit positions has a value of1.
$bitsAllClearMatches numeric or binary values in which a set of bit positions all have a value of 0.
$bitsAnyClearMatches numeric or binary values in which any bit from a set of bit positions has a value of0.

Comments

NameDescription
$commentAdds a comment to a query predicate.

Projection Operators

NameDescription
$Projects the first element in an array that matches the query condition.
$elemMatchProjects the first element in an array that matches the specified $elemMatchcondition.
$metaProjects the document’s score assigned during $text operation.
$sliceLimits the number of elements projected from an array. Supports skip and limit slices.













Previous
Next Post »