Connecting with a client that uses pouchDB to cloudant-node-sdk - ibm-cloud

I would like to connect my client using pouchDB however it appears that the API looks different than couchDB API. is it still possible to use cloudant-node-sdk with pouchDB without too much work around?

Related

Integrate MongoDB with Firebase

I have a Flutter app (still in development) that currently uses Firebase for the backend. More specifically, I use Firebase Authentication, Storage, Cloud Functions, Firestore and in the future I am willing to use Remote Config, Dynamic Links, Cloud Messaging and more of Firebase's features.
I got to a point where Firestore is not enough anymore for my purposes: Full-text search, geographical querying and advanced queries in general. I know that I can use 3rd party services like Algolia for this but It's too expensive and I wanted something already integrated with my database.
I was thinking of start using MongoDB as my database (while keeping all other Firebase services) but before I do that I need to understand what is the best way to do it.
Can I host MongoDB on Firebase Hosting (I don't know if this possible at all?) or just use MongoDB Atlas and access it directly (See my next question) from my application?
What is the best way to connect my application to MongoDB? From the app directly (using Rest API) or using Firebase Cloud Functions (so I won't expose my database)?
Can I use Firebase Authentication tokens to access MongoDB or do I have to use MongoDB's authentication service?
If there is more things I need to consider before I start switching to MongoDB please point it to me.
Firebase Hosting is a CDN for hosting static websites. So it is not possible to host an application like MongoDB server. You can't host MongoDB on any Firebase services. You have to deploy it somewhere else. There are several options. You can either get a VPS and install MongoDB server on it. But you will have to manage your own DB which can be difficult and can take quite some time. Another option is to use a Cloud Database like MongoDB Atlas. This is a faster and more secure solution. However, pricing can be high. So you have to decide depending on your needs.
Once you have a running MongoDB server, you need to write an API for client apps to communicate securely. Client apps should never talk with a DB instance directly. In this case you can use Firebase Cloud Functions to create an api.
You can use Firebase Auth service with Firebase Cloud Functions. You should have a look at the Firebase Callable Functions which can pass auth context to the function body. Here you can just ensure the user is authenticated or perform some access control logic depending on your authorization needs.
Overall, you are going to add an another layer to your architecture. It is possible but will take your time to set things up and you will loose some firestore benefits like offline persistency.

how can I work my online java web application to work in offline?

I want to add the feature of database synchronization to my project. It should be like this:
When the internet connection is available the application should transact with the online database server.
When the internet connection is not available it should keep track of the transactions and should update the local DB to online DB server when connection is available it should synchronize.
How can I do this?
Before that we are using Multi Tenant concept in our web application. Single online DB can access all clients using multiple schema.
I want to know how can my web application work in offline mode. If I use HTML5 application cache concept means the HTML and CSS file will load from cookies. How can I get the database value from database when application goes offline.
What is a good way to make my application work online and offline with database?
Most modern browsers have databases or persistence facilities similar to a database for pretty much exactly this use case.
You may end up having to dive pretty deep into javascript to get it to work though. (Especially when the online DB comes back online and you have to go back through all the offline data and send it up (post) to the server end)

Is it possible to use two different database for offline web application

I have a web application which currently uses postgres database. But I would like to make my application work in offline too. I found that CouchDB/PouchDB supports offline for web applications. But it says I have to use CouchDB in my existing backend instead of postgres.
I would like to know is it possible to implement CouchDB in web app without changing the existing postgres database?
Do I need to change the postgres database to couchDB to implement this feature?
It is possible to do this - at least in theory. And I have certainly not done any work in this area yet so I cannot advise you on how to implement it. But PouchDb does support LevelUp as a backend to the PouchDb Server (I am not sure if this also applies to the PouchDb client).
This means that you could use PouchDb for your offline web application and sync data to the PouchDb Server, but use the LevelUp capability to use PostGres SQL as the PouchDb Server storage service.
There is a good article by Nolan Lawson entitled "PouchDb levels up" that describes this capability here.

MeteorJs MongoDB production deployment

I'm new to MeteorJS and I have a few nagging questions.
If these are overly simplistic forgive me. :)
Background: I would like to use this framework to write a mobile app (no web side as of yet) and hit my existing RESTful endpoints for data querying and CRUD.
Since I do not need a database (bc I already have one connected to my other backend) how can I go about removing or turning off MongoDb? I found this SO answer and I remove the meteor-platform but it somehow gets added back in. (Just doing the standard meteor create --example todos)
If I am unable to turn the Mongo functionality off, would there be any downside to keeping it there and just never using it?
Lastly, what happens when I deploy my MeteorJS app to iOS/Android with respect to the MongoDb I was using locally? I assume there is a hole somewhere that I supply a URI to so that that app knows how to get to it? I can't find this place if such a thing exists.
If you do not use any of meteor's server functionality (login, publish, methods) then there is no way for your client application to find out that the server has not been started.
You can safely use HTTP on the client to use your RESTful API.
The mini mongo on the client is pure javascript and does not require a server connection. But there is no easy way to keep data in the mini mongo database without setting up a publish-subscribe link via DDP.
The packages like GroundDB assume there is a server side.
In developing you app, you will have to run the meteor server app in order to be able to serve the refreshed application every time a code change happens.

Connecting to a MySQL database using Xcode and Objective-C

I have been interested in working with a MySQL database in my iPhone or Mac projects. How is a connection performed in Objective-C?
I only had a bit of experience with PHP, but heck, that is a bit too different =/
Check this tutorial for connectivity with SQLite.
You will not be able to connect to MySQL directly from the iPhone. You must use some intermediate layer such as a Web application with PHP.
So, you will have something like this:
iPhone POSTING a request to the WebServer using HTTP
Web Server connecting to the MySQL database
Web Server returning data to the iPhone (XML, plain text)
iPhone processing the data
You can use this technique to query and insert/update/delete data.
Once I found this library for MySQL, and I am aware how it works.
It's a much better option not to deal directly with MySQL, but use Apple's Core Data API.
It allows you to manage an relational database without having to write SQL. It's very fast, very useful. Good stuff.
Try absrd which recycles connections across concurrent threads (queues).
If you want to connect to a MySQL database, use MySQL's Connector/C API library which, as Objective-C is a strict superset of C, you can use without any issues. I helped someone with the installation of it here.