MongoDB query returns “Error: Invalid JSON object” on valid query

MongoDB query returns “Error: Invalid JSON object” on valid query

I have probably mucked up the syntax for the JSON query, but cannot for the life of me see where. Trying to create data.frame overviewData grouped on four values with an extra COUNT-feature.

Issue

I have probably mucked up the syntax for the JSON query, but cannot for the life of me see where. Trying to create data.frame overviewData grouped on four values with an extra COUNT-feature.

Code

overviewData <- M_CONNECTION$aggregate('[
        { 
            "$group" : {
                "_id" : {
                    "Hotel_Name" : "$Hotel_Name", 
                    "lat" : "$lat", 
                    "lng" : "$lng", 
                    "Average_Score" : "$Average_Score"
                }, 
                "COUNT(Hotel_Name)" : {
                    "$sum" : NumberInt(1)
                }
            }
        }, 
        { 
            "$project" : {
                "Hotel_Name" : "$_id.Hotel_Name", 
                "lat" : "$_id.lat", 
                "lng" : "$_id.lng", 
                "Average_Score" : "$_id.Average_Score", 
                "COUNT(Hotel_Name)" : "$COUNT(Hotel_Name)", 
                "_id" : NumberInt(0)
            }
        }
    ]',
options = '{"allowDiskUse" : true}'
)

I have quotes around all of my queries, as well as around the options. Still getting an "Invalid JSON object"-error message.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

JSON Tutorial For Beginners | What is JSON | Learning JSON with JavaScript

JSON Tutorial For Beginners | What is JSON | Learning JSON with JavaScript

GraphQL JWT Authentication with MongoDB and Ktor

GraphQL JWT Authentication with MongoDB and Ktor - We're going to apply Json Web Token on our Ktor Application. JSON Web Token creates a stateless authenticated APIs.

R Programming For Beginners - R Language Tutorial - R Tutorial For Beginners

R Programming For Beginners - R Language Tutorial - R Tutorial For Beginners