I have a basic Nodejs server connected to my ios App and firebase client. I want to fetch data from the database, which is in and system generated alphanumeric format(ex: -ibdUKV6168ded). I obviously cannot input that manually every time theres such entry, also I dont want to fetch it by having an index number of the array. How can I fetch that key.
Plus, Every time such key is generated, i want to read the document present in it.
I am out of ideas.
Any help will be much appreciated.
The database looks like this:
I want to fetch the post keys explicitly. I have a on() event called each time a new post is generated. How can I reference them.
This is solved by the firebase functions. Although, they are in beta, they are a great help. Functions along with Admin SDK provide really great combination to deal with such querying of data, where the values are uniquely identified.
Related
I'm developing a nodejs back-end application which will fetch data from third-party Hotel API provider based on the user input from the Angular application. User should be able to filter and sort the received data like filtering price, hotel rating and sorting price, hotel name etc. but unfortunately API doesn't support this. So I thought to store that data in nodejs temporarily but I'm not sure what's the right approach. Will Redis support this?. A good suggestion will be really appreciated.
Redis should be able to support something like this. That or you could do all of the sorting client side and save all the hotel information in local or session storage. Either route you go with you'll need to make sure to save the entire response with a unique key so that it is easy to fetch, or if you save individual values to Redis make sure each has a key to query against. Also keep in mind Redis is best for caching information for short term periods rather than long term solutions like PostgreSQL and MySQL. But for just temp responses, it should be a fine approach.
I want to use Redis by which every time the user will see the post that is coming from the database, I want to process it by Redis.
I have a multiple posts on a database. On front-end, we use the method of data chunking.
For that Front-end call the API and send the time == null, so back end understands that it requires the fresh 20 data. For that pick the latest post and use the limit() to send first latest 20 data.
After getting the data when the user scrolls down then again front end calls the API and send the time == last post created date time. Back end will find data which date is less than the front end send date. By this way again send the 20 data to front-end.
Now I want this to be with Redis. I am confused about whether I will store the complete 20 sets of data or store one post data at a time.
Problem is if store the data on blocks like an array of the object where 20 data will store on an array then if I want to modify the data then how will I do it because Redis will not update the single entity on a block. It will update the whole block
If I go to single entry, then how will I share the 20 data to front-end because by this way redis will store the single entity where each key is bind with single post.
Please tell me that how social network like facebook, Instagram or twitter handle this.
Also, suggest me that is it beneficial for using redis on the post. Any help or suggestion is really appreciated for that
I have an nodejs server running witch show data on a web interface. The data is fetched from a MongoDB using mongoose. The data is added via an node-red application witch is isolated from the rest.
Currently my nodejs server fetches the data every 5 seconds. Is there a way to know if the data in my MongoDB has changed?
Thanks, I hope my question is clear.
I was also looking for something similar to what you are asking for few months back. Few ways which i know to do it are:
1) You can try to use middlewares while inserting your documents in DB. You can then send that new data either after saving it in DB or at the time of insertion only.
2) Refer to this answer which talks about solving your problem using inbuilt functions provided by mongoDb. You can study in deep about them in mongoDb docs.
3) There is also another way to do this which includes listening to changes in log files. As you know everything done in mongo is recorded and logged in files so whenever there is some change in data you can know it from there also. You will have to do the digging by yourself in this method.
Hope it helps!
I will need to store photo's on a datastore, store the location in Mongo so I can retrieve it later to display. What is a good way to go about doing this? If I just google I end up getting information on accessing the files in node itself.....
At this point I am not sure what datastore I will use, for now just on another server I have, Ubuntu Server.
I made something like what you need. I had to store photos on s3 and store the path on mongo. If you use amanzon too, they provide a sdk, that contains all possible functions for interactions with the cloud. So you'll need a way to work with asynchronous tasks when store the data in the cloud, I used async module to manage the functions. I hope I gave you some direction where go to. I can't help you code, once I don't know your business rules, good lucky
I want to clone a public api into a mongodb database with nodejs so I can run my own queries and extend the data like I want. My problem is that I want to fetch the newest updates as well. The good thing is that I know when the data will change at the api app approximately.
I thought about something like cronjobs or a setInterval.
In the internet I could find many solutions how to transform a database into a rest api but no vice versa.
Please give me suggestions how to solve this problem.