Regression: Script remain pending with nested query

Stefano De Amici shared this problem 20 months ago
Solved

With this sample script, the script remain in pending waiting the answer of the funtion.

It happens also if I pur the query inside the loop


var clubList = ["5bd73d627d9d5b2fd0ced54e",
"5bd317dca89c2f539183f6a5",
"58a718d60f9b15ee7842f9ef",
"5bc8aca5d73ee039041902eb",
"5bced449dcf53a056d645b54"]

var result = db.userclubs.find({}).where("club_id").in(clubList)
    .map(
        function(u) { 
            var today = new Date();
            
            u.total_booking = findBookingForClub(u.club_id,new Date('2015-06-01T02:00:00.000+02:00'),new Date('2030-09-09T02:00:00.000+02:00')); 
            
            return u;
        });

function findBookingForClub(clubId,from,to)
{

    return db.bookingstatistics.aggregate([
            {$match: {"club_id": clubId,"booking_info.is_deleted":0,"booking_info.booking_date": { $gte : from,$lte : to } }}
        ]).count().toString();
}


It was working with version 4.


Thanks

Comments (1)

photo
1

Thank you for your feedback. Which build are you using? If you are using 5.0.0, please download the latest 5.0.2 and give it a try. https://nosqlbooster.com/downloads

If it still does not work, could you please give me some test data and detailed steps to recall the issue quickly?

photo
1

Thanks for the fast ereply.

No it still not working in 5.0.2.

To replicate it try to create a nested query like my sample on a your data set.

photo
1

We have worked out a new build 5.0.3 to resolve this issue, please download and give it a try.

https://nosqlbooster.com/downloads

photo
1

Thank you last release resolve the problem!

photo