I think that MongoDB meets my needs for tracking business clients and their orders, with fast development time. But I have hit a roadblock in the documentation and can’t find what I need. It seems to focus on data and queries, but not programming.
Can anyone please advise me how to run full-scale JavaScript programs that interface with my MongoDB, running only locally on a Windows server? Is there a Compass command or other command to run such programs? Is there a menu system for running such programs? How do I debug such programs, given that they are not running in a browser, so there are no Developer Tools and not even a Console?
Or would I be better off using PHP and the MongoDB library code? No, I don’t want to run using Smalltalk, Ruby on Rails, React, C++, Python, or any other language or framework. Just JavaScript, please. With some sort of debugging tools, please.
Also, can Mongo/JavaScript do asynchronous programming? Can I “await” a Mongo Promise to do a query or update while my program does something else until the Promise resolves?
Node is a little operating system with many dependencies that I don’t want on my computer. I especially don’t want NPM, which is an enormous library of software I don’t need.
Compass contains a complete Mozilla implementation of JavaScript, supposedly. I don’t want node on my computer, I want to develop with JavaScript, including debugging, preferably inside a browser so I have the Developer Tools available.
I will try. But is there any way to get access to MongoDB, community version, from the JavaScript running in Firefox or Chrome? It would be ideal to do my development locally in a browser, so I have access to Console and other Developer Tools.
I tried to install the MongoDB Shell (mongosh) using the instructions at instructions and failed. First, I downloaded the zip file for Windows 64. This expanded into a folder containing a file mongosh.1.gz and a few other files. The instructions say to expand this .gz file, so I used 7-zip to expand it. The file inside, mongosh.1, was not of any known file type, so 7zip could not expand it further. Windows does not know what to do with such a file.
I can understand why a Windows installation would not be as easy as a Linux installation, given that few developers work on Windows. But this installation really does seem to fail.
No, no particular reason. When I looked there, I only saw a .zip file download. Thanks for this.
ADDED: Ah, I see the problem. There are several selection boxes. The last one is Package. If it is set to Zip it only offers Zip as a choice. It is necessary to open the Platform box, and near the end of the list is Windows/msi, which is the installation option that works. The way the download dialog works could be improved a bit.
I can certainly run this from PHP code running in a local browser using either GET or PUT, so I should be able to connect to the DB this way. Now, how do I retrieve a connection resource/pointer/object and use HTTP commands to do DB operations? Must I use the PHP library for MongoDB, or can I connect directly?
Note that the js driver is a library, if somehow you are able to put the library where the browser can see it you might be able to import it with a <script> tag.
Thank you for continuing to reply even though you cannot help me.
The page you linked to makes it clear that the data api is normally disabled, and can only be enabled for Atlas, which is MongoDB in the cloud, whose data and programs are owned by whoever maintains MongoDB. As I’ve said above, I’m using the Community MongoDB, not Atlas. The reason is that I want to guarantee my clients security by not putting their data on the Web, in the cloud, or under the protection of a third party. Instead, I run the current mySQL database and its programs on a local Windows server having no access from outside of my local wireless network. I want to do the same with MongoDB and switch from relational records to JSON.
So, I still need someone to help me understand how to access MongoDB using REST (HTTP commands). I do not need all the fancy caching and other features provided by the various libraries for MongoDB, as my data is simple, and limited to just a few thousand records with no concurrent access needed. I want to use MongoDB under the assumption that it stores the data more efficiently than I could store it using my own hashing algorithms.