I have the following firebase schema and using this code $firebaseArray(talksRef.orderByChild('time').limitToLast(100)) in order to sort but somehow it doesn't sort correctly at all. And I suspect that firebase stores the number as string so sorting returned incorrectly. So my question is how to store actual number into firebase data and sort them out accurately.
Thanks
Related
I'm creating a planning app for my users.
I have multiple array of json :
users array
planning array with all slots working in a week
fonctions array of users (what they are doing in my companie)
absences array where my users are off (holidays or other)
With these array, I'm building another with absences of users based on slots working planning.
My code is functionnal but not optimised, it's work with small data, but when I push lot of data, this become slowwwwww.
Can you help me to optimise the code, and got the latest array ?
thank you very much
Here is my sand : https://codesandbox.io/s/snowy-glitter-i76i3h?file=/src/App.js
I am parsing json fields from my logs, in some of which I have arrays. Sumo seems to understand arrays fine, but I don't see a method of extracting the number of items in an array. (length, count, etc.)
length seems to be for character count only. But I'm adding a screenshot for demonstration of what I'm looking to do. In this case, body is an array of objects.
Say I have an array of strings: var myFavouriteSites = ["www.fb.com", "www.xe.com", "www.youtu.be"];
Is there a way I can push this array into the realtime database as one 'field'? All stored in one place? Because I have read that they must be matched with a unique id/key and I am not familiar of how to do it.
I'm not sure what you mean by "in one place". But I can tell you that everything in Realtime Database is essentially key/value pairs, where the values are either strings, numbers, or other objects. There is no native "array" value type. Arrays get translated into objects where the keys are array indices. So if you assign an array at /location:
["www.fb.com", "www.xe.com", "www.youtu.be"]
You'll get a database structure that looks like this:
/location
0: "www.fb.com"
1: "www.xe.com"
2: "www.youtu.be"
I'm trying to make same data aggregation in Firestore whit cloud function to save same read...
In this particular case i have users and groups of users. On new user i'm saving name and id in a Array in the user group.
Everything is working perfectly (kudos to all fireStore devs), but those array may and will grow a lot.
I'd like to know if there is an artificial cap on array size or if it works like the binary field (max 1mb), and if there is same way to know when i'm approaching the limit
I am new to use mapper following IKAI source to learn.
Assume the mapper is iterating over a datastore entity(Say PowerHouse which is having currentConsumption fields which maintains the amount of current consumed for each house)
I need the mapper tool to traverse the complete entity and get the sum of it currentConsumption field.
According to IKAI Demo
I am able to traverse the each row of PowerHouseTable but Not sure how to sum up the currentConsumption.
Any help greatly appreciated.
Yes, you need a Reducer step to aggregate the currentConsumption.
Normally, it is easy, just try to implement a Reduce function with regards to the Map function that you already have in order to aggregate the results.
Try to look on the WordCount example, it has almost the same principle that you are looking for.
http://hadoop.apache.org/docs/r1.2.1/mapred_tutorial.html#Example%3A+WordCount+v2.0
So, in the word count example, in the map function, it gets word by word and assign to it 1. That means, the map result is a list of (key is word and the value is one). In you example it will be the key house and the value is the currentconsumption for that house.
In the reducer, in the word example, the output of the mapper will be the input for the reducer. The reducer sums for the same words the 1s to get the overall sum of that word. the results will be a list(the key is the word and the value is the sum). Same thing with your case and as a result you will get as a key the house and the value will be the currentConsumption.
Sum requires a reducer step since it is an aggregation operator.
https://code.google.com/p/appengine-mapreduce/source/browse/trunk/python/demo/main.py#256 for a Python example that uses a reduce phase and https://code.google.com/p/appengine-mapreduce/source/browse/trunk/java/example/src/com/google/appengine/demos/mapreduce/entitycount/ for a Java example.