mongodb :: MongoMatch :: op
field
If no field
is specified, append the operator the the root object:
{$<name>: <value>}
Else, append the operator to the field:
{field: {$<name>: <value>} }
# Define a custom operaton for `field`
#
# If no `field` is specified, append the operator the the root object:
# ~~~json
# {$<name>: <value>}
# ~~~
#
# Else, append the operator to the field:
# ~~~json
# {field: {$<name>: <value>} }
# ~~~
fun op(name: String, field: nullable String, value: nullable Serializable): MongoMatch do
if field != null then
var q = new JsonObject
q["${name}"] = value
self[field] = q
else
self["${name}"] = value
end
return self
end
lib/mongodb/queries.nit:73,2--93,4