Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to implement $$ROOT

See original GitHub issue

How one could implement $$ROOT variable as in here

It’s in mongo since 2.6.

Do ‘custom operators’ fit for this?

I tried to implement it this way, but it doesn’t work.

Mingo.addOperators(Mingo.OP_PIPELINE, function (m) {
  return {
    $$ROOT: function (obj) {
      return obj;

It throws the error: “Invalid operator name ‘$$ROOT’”

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

kofrasacommented, Feb 3, 2017

I have implemented $redact on the development branch. Looking good so far and should be out in the next version. With regards to the system variables they can be handled directly within the value resolution functions. I don’t think it is a good idea to allow defining new ones at present.

After careful consideration, I still found the ones available to $redact more useful though $$ROOT can be implemented quite easily. $$CURRENT can also be handled but will require a way to rebind the variable as per the documentation.

@zag2art Out of curiousity, what is your use case for requiring $$ROOT?

kofrasacommented, Feb 8, 2017

Still some more work to do then. My implementation did not handle subpaths for $$ROOT.

I will make the update in the next minor release. Thanks for the tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Implement Root Detection in Android Applications
The goal of comprehensive root detection is to make running the application on a rooted device more difficult. Detecting rooted devices alone are...
Read more >
How to root Android phones and tablets (and unroot them)
One of the easiest ways to root an Android device is by using an app, and several rooting apps have garnered attention over...
Read more >
How to root Android: Everything you need to know!
The good news is that rooting is much easier than it once was in many cases. In fact, the easiest method is usually...
Read more >
How to root your Android smartphone: Google, OnePlus ...
Rooting your phone is still possible — and fun — these days. Here's how to do it on your Android device.
Read more >
How to easily root an Android device - CNET
Now you can install KingoRoot. Then run the app, tap One Click Root, and cross your fingers. If all goes well, your device...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found