獲取集合
getCollection()
參數(shù):字符串
查詢
getCollection('table').find()
參數(shù):字典,{}
插入單條
insertOne()
參數(shù):json,python字典,{}
批量插入
insertMany()
參數(shù):數(shù)組(元素都是json),列表(元素都是字典)
返回查詢數(shù)據(jù)條數(shù)
count()
限制返回條數(shù)
limit()
排序
sort()
字段值-1為倒序
修改數(shù)據(jù)
updateOne()
updateMany({$set:{}})
參數(shù)一致:json
刪除數(shù)據(jù)
deteleOne()
deteleMany()
數(shù)據(jù)去重
distinct()
參數(shù):key,{"key":{"$gte":"value"}}