MongoDB on mobile device with AppStudio - possible?

224
3
03-29-2018 01:42 AM
PaulHaakma
Regular Contributor

Does anyone know of a way to get a MongoDB instance going on a device and accessible using AppStudio?

I want a local instance going that I can store and query JSON objects in.

Or, bonus points if anyone can tell me how to sync an AWS DynamoDB (a NoSql database) with a local database using just AppStudio.  

0 Kudos
3 Replies
BrandonBrooks
New Contributor

I am using MongoDB Atlas and their API to access a Mongo DB Cluster from my AppStudio QML application. Then is just http requests from the application to API.

Link: API — MongoDB Atlas 

As for accessing a local instance of MongoDB, I'm not sure. My application needs are mobile, so working with the API is the key for me. I did look into the Mongo DB C++ driver at one point, with the thought that I could incorporate the MongoDB driver directly into my app with it's own class. 

Link: MongoDB C++ Driver Manual 

Link: Integrating QML and C++ | Qt QML 5.10 

0 Kudos
PaulHaakma
Regular Contributor

Thanks Brandon.

Yeah it's the local side that I'm more interested in. I'm looking at hooking up an AWS API point to retrieve and set some data in a DynamoDB instance, so similar to what you mention with MongoDBAtlas.

Cheers,

-Paul

0 Kudos
StephenQuan1
Occasional Contributor III

Hi Paul,

For a cross platform solution, yeah, you're pretty much restricted to REST API end points.

For that, we generally recommend either XMLHttpRequest or, AppStudio's NetworkRequest which has support for downloading blobs to files.

If you know you're running on Windows, you can consider using Simba's ODBC Drivers with the SqlDatabase to connect:

// MongoDB ODBC sample

SqlDatabase {
    driverName: "QODBC"
    databaseName: "Driver=Simba MongoDB ODBC Driver;Server=[ServerInfo];
Port=[PortNumber];Database=[MongoDBDatabase];"
}

// DynamoDB ODBC sample

SqlDatabase {
    driverName: "QODBC"
    databaseName: "Driver=SimbaDynamoDB ODBC Driver;
Host=dynamodb.us-west-2.amazonaws.com;Region=us-west-2;
AuthMechanism=1;CredentialFile=C:\credentials.txt;
ProfileName=simba;"
}

References:

   https://gist.github.com/search?utf8=%E2%9C%93&q=%40stephenquan+appstudio+sqldatabase+drivername&r...

   https://www.simba.com/products/MongoDB/doc/ODBC_InstallGuide/win/content/odbc/m2/strings.htm 

   https://www.simba.com/products/DynamoDB/doc/ODBC_InstallGuide/win/content/odbc/dy/strings.htm 

Stephen

0 Kudos