How to move incrementaly mongodb database to production? - mongodb

(Maybe I am missing the point here, but I was unable to find answer so far o.O)
I have online app that I develop locally on my PC with MongoDB (C#). I need to move database incremental changes to production without losing existing customer data in production database, and - preferably - with minimal (or even no) downtime...
How can I do that?
Or if my idea of nosql database is wrong; How should I solve experimental development of live database?

Related

NoSQL development/production database

I am in charge of the database for an application that we are developing and I am starting to get confused on how to use my development database.
I understand that having two separate databases is useful, helps while developing new features or change the database structure and this is why we actually have a production database and a development database. However as the project grows I am slowly getting confused on how I should use the development database and the development environment as a whole.
Our data is stored in Firestore which is a NoSQL database. We use it to store real time data that need to be accessed both by users and by a growing number of scripts that process the data to create some more. This real time data is also useful while developing to monitor the behavior related to the changes we made for a specific feature (on our test app).
So my question is :
Should my development database be a copy of the production database (copy every insert, update, delete ...) and should we duplicate all our scripts (one on the production environment and one on the development environment) that process the data ? In which case I would need to create connexions between each database and the costs related to storing and processing the data would double.
Or should I just use the development database as a database with the same structure as my production database, with less data and just pull some data or activate some pipelines to redirect some real time data when I need to test a new feature or a change in my database.
Also if you know a good book that I could read on the subject I'd take it !
Thank you,

MobileApp / Data Sync / Existing database

I'm working through the issues of using an offline data sync with a mobile back end, and have worked through numerous articles/documentation regarding it's use.
The scenario that I'm looking for is a bit different that the normal demo projects. We have a Azure SQL db that we have been using for some time now, and a use case has come up to use this data in a mobile back end.
I have yet to see an article on how best practises of using an existing sql DB (EF codefirst), with offline data sync tables that need to inherit from EntityData, which adds additional fields for the sync process.
My original thought was to use the ef code first definition of the data models, and use them with Mobile App... however the requirement for EntityData doesn't work, as I'm not going to add those fields to a production system.
My question is, what is the best practise of using data from a production system, and get them syncing with mobile back ends? I'm thinking a intermidary DB is required, but that just means that there are three databases/tables to sync - which doesn't feel right at this point in time.
Anybody know of an article that starts with an Azure DB, and the process/decisions they made to allow data sync to offline devices?
This scenario is discussed in detail in my book - http://aka.ms/zumobook - chapter 3.

How to have complete offline functionality in a web app with PostgreSQL database?

I would like to give a web app with a PostgreSQL database 100% offline functionality. In an ideal case the database should be completely replicated in the browser per user, and synchronized when online. So that the same code can be used to talk to both the offline and online database. I know this is possible with PouchDB and CouchDB, but have not found a solution that works with PostgreSQL. Is this at all possible?
Short answer: I don't know of anything like this that currently exists.
However, in theory, this could be made to work...(long answer:)
Write a PostgreSQL backend for levelup (one exists for MySQL: https://github.com/kesla/mysqldown)
Wire up pouch-server to read/write from your PostgreSQL db using pouchdb's existing leveldb adapter (which in turn will have to be configured to use your postgres backend). Congrats, you can now sync data using PouchDB!
Whether an approach like this is practical in reality for your application is a different question you'll have to answer.
You may be wondering, for example, "will I be able to sync an existing complex schema with multiple tables to the client with this approach?" The answer is probably not - the mysqldown implementation of leveldown uses a single MySQL table with three fields: id, key, and value (source), and I imagine any general-purpose PostgreSQL adapter would be similar (nothing says you can't do a special-purpose adapter just for your app though!).
On the other hand, if you were to implement a couchdb-compatible API (or a subset- you may not need attachments, for example) over your existing database schema, there's nothing stopping you from using PouchDB on the client to talk directly to that as if it were an actual CouchDB - just pop in the URL and call replicate()! Implementing the replication protocol might be a fair bit of work, since you'd need to track revisions and so on somewhere - but again, technically not impossible!
There are also implementations of levelup's backend storage that are designed for browsers. See level.js, which could be another way to sync between a server-side Postgres levelup backend and the browser.
TL;DR: There's tons of work being done around Javascript databases right now. Is syncing with Postgres impossible? probably not. Would it be a lot of work? Definitely. Worth it? Who knows, but it would be cool.
Without installing PostgreSQL on the client? No. Obviously you can cache data for offline use, but an entire RDBMS+procedural languages in Javscript, no.

MongoDB - Importing a db from local machine to MongoLabs

I have a decent-sized database on my local machine that has a lot of important data that cannot be re-made easily (locally-tested user profile informatino, blog posts, that sorta thing). It's around 50mb in size.
I'm getting close to making my app live, and I want to bring this database to MongoLabs. I know how to connect to MongoLabs and set up a new database there, but I can't work out (if it's even possible) how to import a database from my local machine to MongoLabs, nor can I find any documentation discussing this.
Questions are:
Is this possible to do
How do I do it?
If you open your database at mongolab.com and go to the Tools tab, you should see some helpful commands for migrating your data to your new database.
This support article also has more details:
https://support.mongolab.com/entries/20164381

ASP.MVC2.0/EF4.0 site deployment/maintenance

My small team used asp.mvc 2.0/entity framework 4.0(model first approach)/Windows Server 2008r2/Sql Server 2008 r2 stack in out web site project. We've already complete developing process, and come to the web deployment stage. In this stage we are faced with the problem - ok we'll use vs2010 features for initial server/db deploy, but what we'll do in the future? Obviously some of our models can be modified after publishing in order to satisfy new conditions, and of course our server db will contains users data sets, articles etc. Is there any approach to update servers db with new db modification, without dropping db, and converting data from old instance to the new one?
Now we have found only DAC/DACPAC approach to update server db, but we don't know how to bind auto EF model generation with DAC.
May be there is exists another solution? Is there any standard way to resolve this kind of situation? Any advice?
Thanks
I'd be interested to know if you have found a solution to this yet?
Have you tried simply generating a database based on your EF model, and using a schema comparison tool such as SQL Compare to deploy changes from the EF-generated database and your target production server?