nitc :: StarRatingRepo :: defaultinit
nitc :: StarRatingRepo :: users_ratings
Find worst rated mentitiesnitc $ StarRatingRepo :: SELF
Type of this instance, automatically specialized in every classpopcorn :: MongoRepository :: _collection
MongoDB collection used to store objectscore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
popcorn :: MongoRepository :: collection
MongoDB collection used to store objectspopcorn :: MongoRepository :: collection=
MongoDB collection used to store objectsnitc :: StarRatingRepo :: defaultinit
popcorn :: JsonRepository :: defaultinit
popcorn :: Repository :: defaultinit
core :: Object :: defaultinit
popcorn :: Repository :: deserialize
Deserialize astring
to an instance.
popcorn :: Repository :: find_by_id
Find an instance by it'sid
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).popcorn :: Repository :: remove_all
Remove all the instances matching onquery
popcorn :: Repository :: remove_by_id
Remove the instance withid
nitc :: StarRatingRepo :: users_ratings
Find worst rated mentities
# StarRating Mongo Repository
class StarRatingRepo
super MongoRepository[StarRating]
# Find most rated mentities
fun most_rated: Array[JsonObject] do
var pipeline = new MongoPipeline
pipeline.group((new MongoGroup("$mentity")).sum("count", 1))
pipeline.sort((new MongoMatch).eq("count", -1))
pipeline.limit(10)
return collection.aggregate(pipeline)
end
# Find best rated mentities
fun best_rated: Array[JsonObject] do
var pipeline = new MongoPipeline
pipeline.group((new MongoGroup("$mentity")).avg("avg", "$rating"))
pipeline.sort((new MongoMatch).eq("avg", -1))
pipeline.limit(10)
return collection.aggregate(pipeline)
end
# Find worst rated mentities
fun worst_rated: Array[JsonObject] do
var pipeline = new MongoPipeline
pipeline.group((new MongoGroup("$mentity")).avg("avg", "$rating"))
pipeline.sort((new MongoMatch).eq("avg", 1))
pipeline.limit(10)
return collection.aggregate(pipeline)
end
# Find worst rated mentities
fun users_ratings: Array[JsonObject] do
var pipeline = new MongoPipeline
pipeline.group((new MongoGroup("$user")).sum("count", 1))
pipeline.sort((new MongoMatch).eq("count", -1))
pipeline.limit(10)
return collection.aggregate(pipeline)
end
end
src/doc/api/api_feedback.nit:248,1--287,3