Search code examples
mongodb-stitch

MongoDB Stitch client.executeFunction is not a function


I am following the dashboard tutorial at https://docs.mongodb.com/stitch/getting-started/dashboard/ and when I try to graph data I get a Javascript error:

Uncaught (in promise) TypeError: client.executeFunction is not a function
    at buildGraph ((index):62)
    at eval ((index):15)
    at <anonymous>

This is caused by the following line:

client.executeFunction("SalesTimeline", (now - duration), now)

executeFunction is not a method in client, so perhaps the way client was instantiated is incorrect, but, so far, I have simply copied the code from MongoDB and I do not know what could be wrong.


Solution

  • There was an error in the tutorial

    <script src="https://s3.amazonaws.com/stitch-sdks/js/library/stable/stitch.min.js"></script>
    

    should have been:

    <script src="https://s3.amazonaws.com/stitch-sdks/js/library/v2/stable/stitch.min.js"></script>
    

    Thank you to Mike @ MongoDB for providing the solution.