집계 프레임워크 (Aggregate Framework)
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
db.collection.aggregate(pipeline, options)mydb.mycollection.aggregate([
{‘$match’ : {‘$text’ : {‘$search’ : ‘ value ’}}},
{‘$sort’ : SON([(‘ field ’, 1)])}, # from bson.sonimport SON
{‘$project’ : {‘ field1 ’ : 1, ‘ field2 ’ : 1, ‘ field3 ’ : 0}}
])from bson.son import SON
"$sort": SON([("name", 1)])mydb.mycollection.aggregate([{
'geoNear' : { 'near' : { 'type': 'value', 'coordinates': [ longtitude, latitude ] },
'distanceField' : 'stringvalue', 'query': {key:value},
'maxDistance' : value }}])