Is there a text file containing my MongoDB data? - javascript

I have been using MongoDB atlas for a while now, and have decided to start hosting the database locally. After creating a new collection, completing all the standard steps, with no errors, and adding a new object with mongoose, I don't see the collection in my data/db file. Is there a different place where I should be looking to find plain text, as such in Atlas?

Like many databases, MongoDB does not store data in plain text files. It does use files but these files are binary and generally not usable directly by users.
Atlas does not provide filesystem access in any event, so whatever files it does use you won't be able to retrieve.
To extract your data, use a tool like mongodump.

Have a look at this page from the MongoDB docs.
It shows how to export the data as json or csv from Atlas

You can take the mongodump of your data from the atlas cluster and later on you can mongorestore it to your local deployment.
mongodump : https://docs.mongodb.com/manual/reference/program/mongodump/#bin.mongodump
mongorestore : https://docs.mongodb.com/manual/reference/program/mongorestore/#bin.mongorestore

Related

How to retrieve 20,000 documents from firestore database using javascript

I am having a firestore database, where it having a collection named emails. In emails it is having thousands of documents with dynamically created DocumentId's but i need to retrieve the data from each & every document.
tried syntax :- db.collection("emails").get().then((snapshot) => {});
example:-
emails - 001H2rmjHGOE4joI9kZQ58e9ET93 - name,age,phoneNumber
00L9cjByEHPmzJpBfhSvuRaiKk42- name,age,phoneNumber
i need all the phoneNumbers from every document by using javascript.
a simple thing, create a bucket in your firebase console, next create a dataset and download the required data using SQL type console it provides JSON, CSV file formats follow below link for the full process.
https://www.youtube.com/watch?v=3J1M1bSwgV8&list=LL&index=14&t=3s

Full CRUD app without a database possible?

If I use a json file stored in one of my GitHub repos as a mock backend, I know how to fetch and read all the data. Is it also possible to edit or post new data to this json file? Would an alternative mock backend like Mocky.io be a better solution (to achieve full CRUD)?
I think you could store the information inside csv files or somehting like that, you would be recreating a database engine as MongoDB & create your own reader to find the info, or you could store the users info using local Storage,
However this would make your app very limited.
Here's the link for the documentation of local storage
https://developer.mozilla.org/es/docs/Web/API/Window/localStorage
Well if you want to try out CRUD operations you can use free JSON APIs like http://jsonplaceholder.typicode.com/ or
https://mockfirst.com/
where you can create, read, update and delete data using various api end points. It is better to go this way first then you could move on to updating a JSON file.
(UPDATE)
You can use https://jsonbin.io/
Here you can place your own data and use it as an API.

SpagoBI data set: use javascript to access to MongoDB data base

Since data set in SpagoBI could be created using scripts, I need to connect, query my MongoDB data base using javascript (or Groovy).
I need to use scripts to be able to execute aggregation on the mongoDB data, I can't use aggregation directly on my MongoDB because my data type is String
I dont know how to access my Database using scripts
Any ideas?
You should create a Mongo dataset. The steps to create are:
Step1: Create a Mongo datasource in the administrator console. Notes: the type must be JDBC and the value for Class input field must be "mongo"
JDBC: {unit_host}:{port}/${db}
CLASS: mongo
Step2: now you can create a dataset. The procedure is the same of the query datasets. The difference here is the language.. JS instead of SQL.
Take a look at the SpagoBI wiki in particolar here: http://wiki.spagobi.org/xwiki/bin/view/spagobi_server/data_set#HQueryDataSet28Mongo29
When connecting to mongoDB, you pass auth stuff in the url. Since the scripts lies on the client side, it would be hard to make the connection secure (unless you are talking about backend JavaScript). Anybody would be able to see how to connect to your DB and for instance delete all content.
I would suggest a simple api to interface the database. Then u control the access to what a user can do towards the database.
Or have I misunderstood the scenario?

JSON data querying by breeze

I attempting my first SPA.
It will be a HTML representation of the model of our database structure to give to clients to look through the model and do queries of the database model (not the database data itself).
The requirement is then for no updates and the SPA will be shipped with the release and thus will be offline. Currently it is a static HTML page.
My question is - is there a way to use breeze to query the json file I've created that describes the model? All I've seen are examples of the EntityManager being initialised with a service URL - that will return the data.
Not quite sure I understand the question. What do you mean by (no server)?. Does this mean that you want to bring all of the data down just once and then query it locally?
If the data that you want to query is actually itself metadata then if you describe the structure of the metadata (i.e. metadata of metadata) in Breeze's native metadata format, then you should be able to query the metadata itself via Breeze's EntityQuery.
Probably a little more info would be helpful.
Also, take a look at the Breeze NoDb sample for an example of "custom" metadata construction.

titanium appcelerator data storeage for newspaper/magazin

I want to develop app for viewing newspaper/magazine using Titanium Appcelerator, and I have a problem how to store data on phone that user can't access it other way than by app ? what format should that data have (blob, pdf, plain text) ? should they be stored in db, or as a files ? Can You post your suggestions below, please ?
In Titanium you have several options to store data. First you should check the data you get as input. Is it JSON or PDF or plain text or whatever.
Following options are available:
- store data using integrated databases (SQLite) - this might be appropriate when your input data is plain text or json that can converted to text or something like that. You can also store blob data in database if you want.
- store data using file system: on both iOS and Android (not mobileweb i think) you can store data persistent on the file storage. This is useful if your input data is a binary file (pdf or similar).
However in both cases the user is able and not able to read data.
- iOS: The User will be able to read documents persisted on the filesystem and maybe also data located in the database
- Android: i think on android this depends on whether the device has root access or not and where you store that data (within app folders or in external / internal but free accessible storage)
In both cases it's not easy to access this data. Usually a common user won't do that. For a professional user reading this data should be easy. So how can you secure this data, so that the user is not able to read it?
Either you store the data encrypted in a database (database encryption is not available in titanium by default so you need to use a module or encrypt data on your own) or you store it encrypted (this is also up to you - there is no ready-to-use method) on the filesystem.
In my opinion the first solution is the better one. I would do the following:
- get data (from the server or elsewhere, data type doesn't matter)
- convert to base64 (useful & required for binary files but also for plain text)
- encrypt base64 with an encryption algorithm of your choice
- store in database
because this can require much memory you should provide the option to remove this data to save space.

Categories

Resources