db.COLLECTION_NAME.aggregate([
// Filter
{"$match":{
FIELD1 : VALUE1
, FIELD2 : VALUE2
}}
// Distinct fields list
, {"$group": {
"_id": {
FIELD3_ALIAS : "$field3"
, FIELD4_ALIAS :"$field4"
}
}}
// Replace root, so the documents are not nested inside an _id sub-doc
,{ $replaceRoot: {
newRoot: "$_id"
}}
]);//aggregate
2018-05-22
2018-05-15
PYTHON - Determine if ANY of the words in a list are found in a given string
wordsList = [ "two", "long" ]
string = "this is a not very long phrase, two would be too many"
if any( word in string for word in wordsList ):
print "yes, all given words are found in the given string"
else:
string = "this is a not very long phrase, two would be too many"
if any( word in string for word in wordsList ):
print "yes, all given words are found in the given string"
else:
print "no, not all given words exist in the given string"
PYTHON - Determine if ALL words in a list are found in a given string
wordsList = [ "two", "long" ]
string = "this is a not very long phrase, two would be too many"
if all( word in string for word in wordsList ):
print "yes, all given words are found in the given string"
else:
print "no, not all given words exist in the given string"
string = "this is a not very long phrase, two would be too many"
if all( word in string for word in wordsList ):
print "yes, all given words are found in the given string"
else:
print "no, not all given words exist in the given string"
2018-05-14
2018-05-05
METEOR - On paste event
Template.template-name-here.events({
'input .class-name-here': function (evt) {}
});
'input .class-name-here': function (evt) {}
});
2018-05-02
Subscribe to:
Posts (Atom)