Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8619563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:22:14+00:00 2026-06-12T06:22:14+00:00

I know about call and apply in javascript and are able to apply them

  • 0

I know about call and apply in javascript and are able to apply them to simple functions, but I get completely confused when it comes to applying them to a chained method call as the one shown below:

db.collection("posts").find({}, {limit:10, sort:[['views', -1]]}).toArray(function(err, posts) {
   console.log(posts)
});

Is it possible to pass the arguments from an array, something like [{}, {limit:10, sort:[['views', -1]]} ] into the above method using call or apply ?

I would like to use this to easily access & modify the arguments by keeping them in an external array.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:22:15+00:00Added an answer on June 12, 2026 at 6:22 am

    I don’t think there’s any way to keep the chaining. You’ll need to store the intermediate result.

    var posts = db.collection("posts");
    posts
        .find.apply(posts, argsarray)
        .toArray(function(err, posts) {
            console.log(posts)
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know about the basic concept of virtual function and run-time call. But i
How can I call Java functions from a C++ application? I know about calling
I know about AJAX cross-domain policy. So I can't just call http://www.google.com over a
I know about http://www.upcdatabase.com/ , but it's quite incomplete. Where popular mobile apps getting
I know about primitives and objects living on the heap, but how does the
I know about map/reduce alghoritm and its use. It's using functions that are called
I know about the ADODB.Stream object . But what I really want is a
I know about Options->Fonts and Colors. But there is no option for F# strings(i
This is specifically about GWT's RequestBuilder, but should apply to general XHR as well.
Hi I'm new in Javascript OO and want to know more about about inheritance.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.