Failing results for Ticket: Faceted Search [Solved]

I have added the following block after the pipeline and before the try: statement and the result is failure, perhaps someone has had better luck?

** “”"
Ticket: Faceted Search

Please append the skip_stage, limit_stage, and facet_stage to the pipeline
(in that order).

The pipeline is a Python array, so you can use append() or extend() to
complete this task.
"""

# TODO: Faceted Search
# Add the necessary stages to the pipeline variable in the correct order.
pipeline = []

pipeline.extend([skip_stage,limit_stage,facet_stage])
try:
    movies = list(db.movies.aggregate(pipeline, allowDiskUse=True))[0]
    count = list(db.movies.aggregate(counting, allowDiskUse=True))[
        0].get("count")
    return (movies, count)
except OperationFailure:
    raise OperationFailure(
        "Results too large to sort, be more restrictive in filter")**

I did find the answer in another question about this. Turns out that they just want the second pipeline = array to be used as an extend, so in my paste block, the pipeline = is removed to fix this as it is reseting the pipeline.extend from earlier in the function:

# TODO: Faceted Search
# Add the necessary stages to the pipeline variable in the correct order.
pipeline = []

pipeline.extend([skip_stage,limit_stage,facet_stage])
1 Like