Treating MongoDB Database as a SQL Database File (.mdf & .db Files) - node.js

I'm new to MongoDB. I'm trying to create a Node.js API that uses MongoDB and deploy it using Firebase Functions. In SQL there was a .mdf file or .db file holding the database. My Question is, is there a file like that in MongoDB i can grab and deploy with my API? or how can i deploy the database I've been working on locally on my PC with my Node.js API to the server i'm hosting on which in this context Firebase functions?
Thank you in advance. and sorry if my question isn't so clear.

There isn't a single file, there is a directory of them. You'll want to copy all of the files in the dbpath, except the diagnostic.data and any log files.

Related

storing csv files on a dedicated server

I'm having trouble storing csv files on a heroku server. I have a javascript application running express and a few other node packages and wondering what I should do in order to maintain those csv files. Heroku will always wipe new data and revert to the last deployed code (https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted), so any new files added while the app is running will be erased. Wondering if I should look for another dedicated service to deploy the project on or store the data in a database.

how to load local file into Azure SQL DB

I have not been able to find a solution to this so will ask the experts.
A co-worker has a .txt file on his laptop that we want to load into Azure SQL DB using SSMS and Bulk Insert. We can open the local file easily enough but we don't know how to reference this file in FROM clause.
Assuming a file named myData.txt is saved to
c:\Users\Someone
how do we tell Azure SQL DB where that file is?
You don't. :) You have to upload a file to an Azure Blob Store and then, from there, you can use BULK INSERT or OPENROWSET to open the file.
https://learn.microsoft.com/en-us/sql/t-sql/statements/bulk-insert-transact-sql?view=sql-server-2017
I've written an article that describes the steps to open a JSON file here:
https://medium.com/#mauridb/work-with-json-files-with-azure-sql-8946f066ddd4
I fixed this problem by uploading the file to a local database and then use a linked server to my Azure db to insert or update the record. Much easier than creating a Blob Storage. However, if the file is very big or you have a lot of files to upload you might not want to use my method as linked servers is not the quickest connection.

how to save uploaded file on elastic beanstalk?

I use a elastic-beanstalk service on AWS by using Node.js.
I use a multer for file upload and uploaded file is saved on webserver.
But when I publish a new version of project file, the files that saved on my webserver are gone.
I want to maintain the file on webserver.
just overwrite not rewrite.
so how can I solve this issue?
Thanks for your time!
When working with Elastic Beanstalk (or any auto-scaling environment), ideally you don't want to store anything on the server itself. If a user is uploading a file, save it somewhere off the server.
In AWS, this typically means storing it in S3 - this means that the file doesn't get lost when the project is updated or the server gets terminated.

setup project for visual studio application using advanced installer with local db data is retrieved but not saved in db

I am using advanced installer (simple) to create the setup project of a GUI i am making in visual studio. upon installation, it is possible to read data from the databse i.e the records that are already added can be read but as i try to save data in databse that function is not working and the application stops working. i think that the connection string is right that is why iam able to read data from it but why cant i update data. plz help.
the databse is is service-based local database
This might happen if you have the database stored in the same install location as your application binaries. Usually that is a folder under Program Files.
You're application cannot write under this location when running as a standard user, and it should never write/store data in that location.
If you're not using the Application Data folder to store your database, I suggest you update your app to do so, this should solve your problem.

Azure Mobile Services - Local DB

I am developing a mobile service. When I run it locally, it uses a local db (I think it is Sql Server Express). When it runs on Azure, it uses an azure sql server instance.
Everything works fine but I don't want to put the local db mdf file into git (it's not really a part of the project - just a temp db for development purposes).
I want to have a script or a piece of code that will create the local database if it does not exist. This way, when a developer clones the project for the first time, she will run the script and it will create an empty mdf file. Db and schema creation will be taken care by the database initializer and the entity framework.
I'm new to MS technologies and I don't know where to start.
What should I use to write such a script? Power shell? And how do I create an empty mdf file?
The .mdf file will actually be created automatically if one does not exist. You can see this in the connection string located in your Web.config.
<add name="MS_TableConnectionString" connectionString="Data Source=(localdb) ...
This connection string value gets overwritten when you publish to the cloud. Instead, the service will use a connections string configured in the portal.
So for your scenario, you just want to make sure that file isn't getting into your repo. You might look at creating a .gitignore file. You could create rule for ignoring all such files, with *.mdf

Resources