Can I control the position of an uploaded document on firebase? - flutter

I need to know if there is a way to control the document position on firebase with flutter, like if the app uploaded sth, it will be on top cause it will really help me, thanks in advance. :)

If you want documents in Firestore to have an order, you will need to populate a field that defines the order. Firestore does not keep track of any ordering for you.
If you want to use the time that a document was added to the collection to define its order in the collection, consider using a server timestamp, and use that timestamp to order your queries.

Related

How to store one-time data in a MongoDB database?

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!

How do I get the number of subcollectors in Firestore?

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.

Flutter TextFormField should give suggestions based on data in firebase

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.

Searching WITHIN a single doc - Firestore

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.

OneDrive Custom Properties

I would like to store some additional metadata with documents that I am uploading to OneDrive using the REST interface. Does anyone know if this is possible at this time? An example might be a hash value that would help me detect alterations without relying on time stamps.
I can't use "Comments" because they are inside the user's field of view which would cause confusion.
Embedding data in the documents themselves is not an option. I don't control document formats.
Any help would be greatly appreciated.
Custom/extended metadata is not currently supported by the Live API for OneDrive.