Getting exception while execution query

Getting mentioned exception/error while executing query on schema:

Error running query: DBRef(u’cmsconsentversion’, ObjectId(‘5f86db5b3209926498d33008’)) is not JSON serializable

Query : {
“collection”:“cmsconsent”,
“query”:
{

}
}

We are using DB refs in our schema and the error is coming while we fetch the complete object. However issue is intermittent and occurring with some rows.

What kind of data source is this? Mongo?

Yes we are using mongo DB.

Does the error occur when you run the following query?

{
    "collection": "cmsconsent",
    "limit": 100
}

Below is the query which we put it in redash.

Query : {
“collection”:“cmsconsent”,
“query”:
{

}
}

So “cmsconsent” collection contains db refs to " cmsconsentversion" collection.

however when we do query through java mongo library we were able to fetch the correct object.

Link1 -> https://docs.mongodb.com/manual/reference/database-references/
Link2 -> https://www.tutorialspoint.com/mongodb/mongodb_database_references.htm

Right but what happens when you send the query I wrote before? The one without a query token?