Difference between MongoDb and module mongoDb - javascript

What is the difference between the npm module MongoDB and the downloaded MongoDb?

The "downloaded MongoDB" (from here) is the actual database server software (MongoDB itself). The mongodb npm module is the node.js native client driver used to access the services of a MongoDB database server from a node.js app.

Related

SailsJS connection with Azure MS SQL Database

I installed the latest version of Sails on my computer and created a new project.
I am using SailsJS as my API and want to connect to the clients' Azure MS SQL database.
I tried using the mssql npm package, even the MS SQL adaptor listed on the Sails documents site, but non of these are working.
With mssql I get the following error when running sails lift in the terminal:
` info: Starting app...
error: A hook (orm) failed to load!
error:
error: Error: Consistency violation: the adapter for datastore default does not have an identity property.
at validateDatastoreConfig`
Any guidance will be appreciated...

How connect to Html page with node.js server and aws virtual machine

I'm trying to install a node.js server for a sentiment analysis service with my Twitter account that retrieve the tweets on my profile and provides a statistical output and saves them on a Mongo db istance.
I have uploaded my node.js code on an AWS virtual machine with an public IP address and with the permission to create an endpoint with HTTP and HTTPS protocols.
I have installed successfully the node.js code on AWS virtual machine with Windows Server 2019 OS, with the npm install -g -n command with 0 dependencies errors, and when I try to connect to the AWS virtual machine with http://ip_public_address:8080 I get the error "impossible to connect - err-connection_timeout".
This is the link to the github project that I need to install and to work on AWS virtual machine:
https://github.com/thisandagain/sentiment
Maybe I am confused about how to connect with the index.html page via AWS virtual machine and I don't know if this page must be retrieved with a IP public address or localhost parameter and what is required, at node.js level code, in order to enable the AWS virtual machine to respond to my browser with the content of index.html page.
Please can you give me advices about to implement successfully this project?
Thanks
Filippo
You don't mention security groups in your question at all, so the likely cause is that you never opened port 8080 in the security group assigned to the EC2 instance. You may also need to open that port in the Windows firewall on that server.

Sails.js connect to Cloud mongoDb Atlas

I created a Sails.js app, it connects to local MongoDB correctly but if I want to connect it to cloud mongodb, Sails throws an error. what should I do to fix it?
default: {
adapter: 'sails-mongo',
// url: 'mongodb://localhost:27017/referral' // this work fine
url: 'mongodb+srv://MYUSERNAME:MYPASS#cluster0.ikncs.mongodb.net/referral?retryWrites=true&w=majority'
},
error:
error: A hook (orm) failed to load!
error: Could not tear down the ORM hook. Error details: Error: Consistency violation: Attempting to tear down a datastore (default) which is not currently registered with this adapter. This is usually due to a race condition in userland code (e.g. attempting to tear down the same ORM instance more than once), or it could be due to a bug in this adapter.
error: Error: Invalid configuration for datastore default: Provided URL ('mongodb+srv://MYUSERNAME:MYPASS#cluster0.ikncs.mongodb.net/referral?retryWrites=true&w=majority') has an invalid protocol.
If included, the protocol must be "mongodb://".
I will appreciate if someone help quickly
I had a similar issue.
The connection string I got from Atlas was for Node version 3.0 or later did not work with the sails adapter.
But the connection string from Atlas for Node version 2.2.12 worked.
From Atlas, click connect -> Connect to your application (using MongoDB's Native Drivers) -> Select Node.js Version 2.2.12 or later. Use the connection string it provides.
I have got the same issue, it’s due to mongodb version used in sails-mongo, for our production database we have worked on improving the existing package.
You can search for sails-mongo-cloud in npm which supports cloud mongo atlas and cluster with server less setup as well.

Cant resolve fs, net, tls after mysql installation

I have react-boilerplate application. I want to start using database so I installed:
npm install mysql
npm install mysqljs/mysql
As shown in mysql webpage: https://www.npmjs.com/package/mysql
Now I get errors when I go to localhost in a browser:
Can't resolve 'fs' in '....node_modules\mysql\lib\protocol\sequences'
Can't resolve 'net' in '....node_modules\mysql\lib'
Can't resolve 'tls' in '....node_modules\mysql\lib'
I am using redux-saga combination.
I figured out that I get the error when I write:
const mysql = require('mysql');
in saga.js file
How can I fix these errors?
You can't use a MySQL client library within a browser app.
The errors you're seeing is the client library attempting to require() Node.js standard libraries for file system, network and encryption (TLS) access, which don't exist in the browser.

How access Realm Mobile Platform from Node.js client?

I am running Realm Mobile Platform on Ubuntu Server 16.04.2 virtual machine and I am able to access the HTML admin panel and connect to the server using Realm OS X browser.
On the server, would be possible to install NPM realm package an connect to the local database as admin user?
I tried calling Realm.Sync.User.login from Node.js console, but I am get an error informing that Realm.Sync is not available at developer edition.
using the node.js Realm SDK with sync is limited to the professional edition. If you would like to use the node SDK with sync you can either get a free trial or install it on an OSX machine.

Categories