Count Objects In Array Javascript Methods For Querying The Document