Can anybody give me a hint ? If you need further information please write a comment.
For Autocomplete solutions, it's advisable to maintain a master list of all entries and keywords that would be searchable, in practice this can be all stored in an array in a single Firestore document - firestore document restrictions apply. You would maintain this with cloud functions based on your design and potentially cloud triggers.
With the new Bundle feature from Firestore, you can allow every client to have direct access to this information, it's only up to you to process the search input and compare it to the master document.
Related
I am building a personal work/career portfolio web app project, and plan on using MongoDB for my database. (I plan to build the project using MERN stack.) Most of my data is not one-time data (such as education, and work experiences), however I have a few pieces of data (such as my personal summary (the content for my "About Me" section), and skills summary) that are one-time only data (I think "single instance" might be a better fitting term). I would like to store all of the data in a database, and set up an admin-end to manage and edit the data. However, I am not sure how to go about storing the one-time data in my MongoDB database.
One idea I had was to create a collection solely for the one-time data, and only allow the user (me) to update and read the documents in the collection. Another idea I had was placing all of my portfolio data into a single collection called "entries", and giving each "entry" a type (such as "Education", or "Personal Summary"). Then when I retrieve the data from the collection I would gather all the documents with the same value in their type field together. I was thinking of storing each of the types as a constant on my server. However, my biggest concern with both ideas is if they would be considered bad practice of not.
I would be very appreciative if anyone has any advice on how to solve this problem.
I had implemented this a while back on one of my small projects, and again after discussing it over with some professionals I'm in contact with, they said that the best approach would be to create a collection with a single document that contains all the information, like the links, about, etc...
One more thing I, was suggested is that we could use Redis solely for the purpose of storing this type of information as well.
Something that I implemented a long time back similar to the one collection, single doc approach: https://github.com/codelancedevs/Sundar-Clinic/tree/local-backend/src/api/app
Working on a similar approach here: https://github.com/kunalkeshan/Cam-O-Genics-Backend
Hope this is of some help, I'm still learning as to what might be the best approach. Open to any suggestions out there!
I'm making a whiteboard app using Flutter and Firestore.
This whiteboard app creates a room first, then creates pages, and then draws inside the page.
Firestore has the following configuration:
I need to be able to get the number of subcollections in Firestore to get the number of pages.
How do I get the number of these subcollections(pages)?
You can't get all collection from one doc in dart.
Retrieving a list of collections is not possible with the mobile/web client libraries. You should only look up collection names as part of administrative tasks in trusted server environments. If you find that you need this capability in the mobile/web client libraries, consider restructuring your data so that subcollection names are predictable.
Here is the document link.
There is no function that can return the number of sub-collections that exist within a document. If you need such a count, you need to create this mechanism yourself. But it's pretty simple, you can create a document in which you can increment/decrement a numeric value, each time a new sub-collection is added or deleted from the document.
I know that you can query a collection in Cloud Firestore to get documents that contain a certain field. However, is there a way where I can query/search WITHIN an already obtained document?
I am using it for a web app.
I know this question is a little vague and I have not provided any code, so I would be willing to provide clarification if needed.
Firestore doesn't provide a way to search the contents of a document snapshot that you already have. You will have to provide code to scan its field values yourself.
I'm currently developing a solution that lets users create a parent listing whereby they can upload files, assign child listings to that and then search their listings based on data from both the parent and child listings.
As an example, think of it as an inventory database. You create your parent listing for say a product, give it a name and upload some images of it. You then create your child listings which would be the stores that stock your product.
Your search capabilities would allow the user to search the product by free text, but also using parameters from the child listings, for example Price, In Stock, Tags etc.
I've tried to develop a concept using Firebase for this which utilises Auth, Storage and Functions, however due to the search limitations of Firestore, it cannot be done.
MongoDB offers something similar to Firebase' functionality whereby I can use Atlas which gives me all the search capabilities I need using Mongo instead of Firestore. In addition, they also have Stitch which provides the Cloud Function, Trigger and Auth functionality I need.
What they don't offer however is any Storage solution.
Does anyone know a way I can use MongoDB Stitch Auth, alongside Firebase Storage to integrate directly with the UI using the Firebase Storage security rules?
I know I could create a Stitch Function that handles the passing of file from UI to Firebase, however I'd prefer to go direct if possible.
I have a string for eg: "My name is John" stored in Firebase.
How would I query firebase so I can find all the posts in Firebase that have "John" ?
I can search for the first term in a string now using:
DataService.dataService.BASE_REF.child("Posts").child(selectedComment.commentKey).queryOrderedByChild("userComment").queryStartingAtValue(comment).queryEndingAtValue(comment+"\u{F8FF}").observeSingleEventOfType(.Value, withBlock: { (snapshot) in
where comment = "My"
I read about using Elastic search with Firebase but wanted to check if there was an easier way in Firebase before I looked at ElasticSearch/Flashlight for Firebase,
Unfortunately, Firebase doesn't support searching thru content like that (in any language SDK). From a Google Groups Post in July '16:
As a company that understands search, we're also a company that
understands using the best tool for the job. For fuzzy matching and
contains, a NoSQL, realtime data store isn't the correct tool--these
queries would be slow and scale poorly. BigQuery or ElasticSearch are
the right tool for providing useful results in a scalable and robust
manner.
Right now, this involves deploying a small node script to sync your
search results with the realtime data, as explained in the article
with the sample Flashlight lib. In the future, it will become more
"effortless" as we add integrations between Firebase and Cloud
products, particularly Cloud Functions and BigQuery interoperability.
BigQuery is, as I understand it, not specifically designed for user-facing search.
Elasticsearch (specifically, the Firebase plugin Flashlight) is a potential solution, but as you alluded to, it's an incredible amount of overhead (deploying/managing or renting an ES cluster, configuring the plugin, etc.). If content search is an important enough part of your app to justify that time/$, you may want to consider solutions beyond Firebase for your database needs, as it's by far one of the service's weakest areas.
In my opinion, you have a few options beyond Flashlight:
Algolia, a Search-as-a-service provider, does offer integration with Firebase, but I've never used it & so can't offer much more than to say that it exists.
Another alternative might be maintaining a collection of documents you want to search on another service, like AWS Cloud Search
Depending on the stage of your project & your needs, consider other Backends-as-a-Service that support more in terms of querying. E.g., GraphQL-as-a-service backends, like Scaphold.io, Graph.cool, and Reindex are all built on SQL databases, and (I believe) all support multiple types of querying.