2

I have a Entries looks like

[Title] => test - Title - 33
[readedBy] => Array (0 => 5999,
                     1 => 85343
)
[clickedBy] => Array (
)
[deletedBy] => Array (
)

And i want to Check in my GROUP reduce function

function (obj, prev) { 
        obj.readedBy.forEach(function (doc){
            if(doc == 800){
                prev.status1.push(obj); 
            }else{
                prev.status2.push(obj);
            }
        }); 
    }

If is there my ID in the Relevan Array to push it to the right Status Array. Foreach is no solution, because that ID array grows > 100k . Is there a good way? Or is that solution rubbish ?

1 Answer 1

1

So far using mongodb map / reduce from what I've gathered, most of the time when you use map reduce you are going to suffer from an O(n) process, which means you will end up doing .forEach() on your result sets. They get faster as you add nodes. as you shard your collections.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.