Using MongoDB and needing countDocuments instead of count as an Action Type or Alternative Route

Hi there,

Still learning my way around ReTool. Is there a way to change the Action Type when I'm writing a mongodb query?

I have:

and need it to actually call countDocuments()

When I run count() on Studio3T for example, my query comes back as:

DeprecationWarning: Collection.count() is deprecated. Use countDocuments or estimatedDocumentCount.


If I do countDocuments(), I get:


I need to get the 103 as my response in ReTool, if I can't add countDocuments(), can I just get the number part of the response I get from count()?

Alternatively, I am just trying to just pass the countDocuments as a command()

and trying this code:

  countDocuments: "accountstats",
  query: {
    accountId: "abc123",
    createdAt: { $gte: {{moment("2023-03-01")}} }

ReTool then tells me:

  • message:"no such command: 'countDocuments'"

But I know that this command works find when I query the db directly:

db.accountstats.countDocuments({ accountId: "abc123", createdAt: { $gte: ISODate("2023-03-01") } });

Got it to work by adding a $date to the $gte:

$gte: {$date : {{ moment(`${year1.value}-${month1.value}-01`).startOf('month').format('YYYY-MM-DD') }}