Skip to content

Sorting in aggregated datasets non-deterministic, causes problems with pagination #25

@jotelha

Description

@jotelha

Sorting in returning aggregated datasets non-deterministic,

@mongo_bp.route("/aggregate", methods=["POST"])
@mongo_bp.arguments(QueryDatasetSchema(partial=True))
@mongo_bp.response(200, DatasetSchema(many=True))
@mongo_bp.paginate()
@jwt_required()
def aggregate_datasets(
query: QueryDatasetSchema, pagination_parameters: PaginationParameters
):
"""Aggregate the datasets a user has access to."""
if not Config.ALLOW_DIRECT_AGGREGATION:
abort(404)
username = get_jwt_identity()
current_app.logger.debug("Received aggregate request '{}' from user '{}'.".format(query, username))
try:
datasets = aggregate_datasets_by_user(username, query)
except AuthenticationError:
abort(401)
pagination_parameters.item_count = len(datasets)
return jsonify(
datasets[pagination_parameters.first_item: pagination_parameters.last_item + 1]
)
. Will likely yield same entry twice and some entries not at all when querying multiple pages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions