How to retrieve 20,000 documents from firestore database using javascript - 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

Related

How i can save json data into database and to foreach after save?

Hello developers I'm working on a categories tree list and want to save it into the database
I use this project from GitHub https://github.com/dbushell/Nestable
How I can save this data into the database?
[{"id":13},{"id":14},{"id":15,"children":[{"id":16},{"id":17},{"id":18}]}]
Front-End :
Through event listeners pass this data to the server as a query string.
Back-End :
Fetch the query string from server using POST method.
Convert the fetched data into the format acceptable to database (depends upon the framework and database used ).

Is there a text file containing my MongoDB data?

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

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?

Storage of Json data to mysql database using php

I am doing a leapmotion webapp on PHP and javascript.it is based on gesture recognition. The values of the leapmotion must be stored into the database and when the corresponding gesture is matched the description of the gesture must be displayed. The values from the leapmotion is converted to JSON format. How can I store the JSON data to the mysql database 5.0.?
The JSON file content is:
{"name":"HA","pose":true,"data":[[{"x":0.16616291409773337,"y":-0.061424365133667,"z":-0.014198921561969446,"stroke":1},{"x":0.058005894163526694,"y":-0.05005164610312531,"z":0.029463953896938344,"stroke":1},{"x":-0.05015112577067998,"y":-0.03867892707258362,"z":0.07312682935584591,"stroke":1},{"x":-0.1583081457048866,"y":-0.02730620804204193,"z":0.1167897048147537,"stroke":1},{"x":-0.2664651656390933,"y":-0.01593348901150024,"z":0.16045258027366138,"stroke":1},{"x":-0.3746221855732999,"y":-0.00456076998095855,"z":0.20411545573256906,"stroke":1},{"x":0.6253778144267002,"y":0.19795540534387668,"z":-0.5697496025117985,"stroke":1}]]}
The error which i get is Syntax error. The work is based on Rob O'leary's leaptrainer.js which can be found on https://github.com/roboleary/LeapTrainer.js/tree/master.
In your situation I'd prefer to do next:
Create separate table for these data. Keys are dependable from your
purposes, but as quick solution just create table with the same
columns names as in your JSON.
Create some model, to communicate with DB. Make there some
methods(like saveMotion, getMotion etc.)
In your php code, use json_decode function, to convert JSON to std
object. Not sure here if you will be able to write std class to db,
but conversion it to array would give you a 100% possibility to do
that.

Populating multiple webpage output with one global database query?

How can one make one global database query (with PHP) and then use all the output (multiple rows) on various places on a webpage?
I read that javascripts can be called for each specific field on a webpage that needs data, but this is inefficient with regards to performance.
The webpage would contact a sort of table-of-contents with version numbers next to each of them. Those version numbers are stored inside the database and calling the database 20 times for the 20 different fields would be inefficient.
Any suggestions on how to run say a PHP query globally when the page loads and then later in the page use the different output at different locations on the page?
QUESTION UPDATE WITH EXAMPLE OF DESIRED OUTPUT:
The webpage should show the following output:
Document Name Document Version
DEPT A DOCS:
Doc ABC 1.2
- Description of doc
Doc another doc 2.3
- Description of doc
DEPT B DOCS:
Yet another doc 0.9
- Description of doc
Doc XYZ 3.0
- Description of doc
Each of the documents have its own version associated with it. Each document has its own table inside the database with its associated version and this can be queried from a Postgres function or View. I wish to query this function or view only once and then display the results in a sort of 'table-of-contents' style (or table sort of view) on the webpage.
Thank you
P.S. This is my first post here.
Make the query in a separate PHP page that is included in all the pages you want to use the information on.
In the beginning of your page make one database query to get data for all versions.
Using PHP split it into associative array having version number as key.
Then during in different section of your page just apply to that array with version number. output the data the way you need. and it will be the data of this version

Categories

Resources