firestation
firestation copied to clipboard
Firestore support
The tool looks great and I would love to use it with Firestore DBs.
Hey Joe,
I have a prototype working on this branch if you want to try it out: https://github.com/JoeRoddy/firestation/tree/firestore
(no promises that it will work on your machine though :/ )
It's been a while since I've worked on this project, but if I see that there is more demand for a Firestore version, then I'll definitely get on it and finish it up.
Awesome. It seems to be working so far. Thanks. Good luck with Texable.
If you find any specific issues with it (I'm sure there are a ton) feel free to open up an issue on it! Would be helpful :D
Biggest one atm is that I can't get the new version to package correctly.
I guess I'll just leave this open until we merge in the Firestore branch.
Would be perfect to have firestore as well.
I have done the checkout to the "firestore" branch and I can't still get access to it. I need something else rather than what we have on the instructions?
Thanks!
@danidfm I should've deleted that branch. I've moved the changes from it to a more stable core electron template. Checkout this branch: https://github.com/JoeRoddy/firestation/tree/projectRevamp
Then you can just run:
$ npm install
$ npm start
If you have any feedback / find any bugs, I would really appreciate it.
To execute firestore queries, you can either toggle the dropdown at the top, or you can reference firestore even while in realtime mode with something like:
select * from firestore.users
This allows you to do really cool stuff, like porting over data between the dbs:
insert into firestore.users select * from users;
Same is true for referencing the realtime db while in firestore mode:
insert into users select * from db.users;
It works! that's awesome.
Really thanks for this work! it helps a lot! :D
@danidfm Glad to hear it! :D
Let me know if you find any issues at all, or even just suggestions would be great. I don't actually use Firestore on my own projects, so I just have a basic understanding of how the collections / document structure works.
Sure!
Will post any issue or idea I could have :)
Awesome, just what the doctor prescribed. This one can grow to what Robo3T is for MongoDB.
@JoeRoddy any ideas how I can query the sub collections in a document?
@catchshyam That isn't supported quite yet. How would you expect the query to look if it was supported?
Something like this?
select * from users.userSubCollection where subCollectionProp = "value";
I have a feeling ^this kind of thing could be really expensive for the firestore read quota.
Is your goal to sort through ALL sub collections that exist and filter by a prop on the sub-document? Or to show all documents that belong to filtered parents? I would guess filtered parents thing will be a lot less expensive, but that's just my intuition, I don't actually use Firestore often.
I'm going to have to re-write the results tree to display documents and collections. At the moment the results tree has no idea whether it's displaying Firestore results or Realtime, just that it's showing data.
I can work on this^ today and I'll push an update and let you know. Would you be willing to play with it / provide feedback when you get a chance?
@JoeRoddy thanks for being so responsive, appreciate it.
In my db, i have 3 levels of sub collections, and I would want to go to the depth my collections are. For example,
Game (root collection) -> Level (sub collection) -> subLevel (sub collection of level)
How I would like to query? select * from game.level.subLevel where level.id = "levelId" and subLevel.id = "subLevelId"
In my case, I have embedded the id into my sub collection documents but everyone may not do that (this is not enforced by firestore).
May be I am asking for too much :)
Ofcourse, I will be more than happy to play around and loop you back.
Thanks a ton.
What do you think about this? :
select level.sublevel from game where level.id = "levelId" and level.subLevel.id = "subLevelId";
^That should maintain consistency with the realtime queries and generic sql and produce what you want (I think). I think the props you're filtering by (level.id && level.subLevel.id) should be relative to the collection you're selecting from (game), otherwise it's hard for the application to know "Does he want the level.id of this document? The one two levels beneath it? etc."
Does that make sense? I totally understand what you're going for in that query, but I have a feeling it would be pretty hard to implement programatically.
Thanks for the feedback @catchshyam !
That's perfect and seems consistent with sql syntax (my sql knowledge is poor)
awesome! thank you @JoeRoddy the 'projectRevamp' branch works well with Cloud Firestore
I'm unable to delete any item
@fdambrosio It's possibly a tweak I made broke the deletes. I'll take a look at it today. Can you give me an example delete statement that isn't working for you?
It's working for me at the moment, example of what I ran:
delete from users where age > 20;
or
delete from collectionName where documentProp (one of > < = != ) someValue;
Nested deletes inside nested document won't work as of yet. Still fiddling around with nested docs and seeing if there's a non-horrible way to query them.
thank you @JoeRoddy , this is an example:
insert into testapp.example.users.01 (name, level, email) values ('Joe', 99, '[email protected]');
delete from testapp.example.users where level = 99;
The insert works but with 'delete' when I press 'commit' button there's no changes on firestore database
Okay, I see what you're going for @fdambrosio . I tested it out and got the same result. It can't delete the item because it doesn't know that the doc exists. If you do select * from testapp
, does anything show up for you? I couldn't get it to, but it did show up on the Firebase console.
I inspected the results data. It knows that the testapp collection exists, but it couldn't find any documents inside of it.
^I think this may give us a clue as to what's going on. I'm guessing this deep structure isn't really supported the way that it is with the realtime database. I'm not an expert at all on Firestore, but I would guess you may want to normalize your data, and bring everything up to a root 'users' collection.
select * from testapp.example.users where level = 99;
this works, so maybe it works only using 'where' ?
Hi, this is a great project, i would love to use it, but i get an error when a run npm start:
` ERROR Failed to compile with 1 errors 22:01:18
error in ./src/index.js
Syntax Error: Unexpected token (22:7)
20 | // }; 21 |
22 | render(
<App />
, document.getElementById("root")); | ^ 23 | `
i don´t know, maybe i am doing somenthig wrong =(
@MiyoAlpizar Did you run npm install
first? What operating system are you on?
hmmm trying to get this running but facing 2 errors
error in ./src/components/App.js
Module build failed: TypeError: Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null
and
error in ./src/stores/Store.js
Module build failed: TypeError: Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null
Steps: i cloned the repo. check out projectRevamp. npm install. npm start. i'm on a mac running high sierra node 9.5.0 npm 5.6.0
... also related may be: https://github.com/babel/babel/issues/7831
anyone else unable to start after an npm update on the projectRevamp branch?
@devpascoe Did a fresh clone and had the same issue. The decorator fix in the issue you linked fixed it for me. Do a :
git pull
npm i
npm start
and let me know if that fixes it for you.
Progress @JoeRoddy ... i can now fire it up but get
An error occurred: { Error: ENOENT: no such file or directory, open '/Users/MYUSERNAME/Library/Application Support/Firestation/extensions/IDMap.json'
and get this in the browser console that shows up in the app
Uncaught TypeError: Cannot read property 'title' of null at Store.setCurrentDatabase
Could this be a result left over from first downloading the released binary on the main website page first, then removing it, then grabbing this repo and running the source?
@devpascoe Definitely could be, it uses web storage and it often cant differentiate between different installations. There should be a cache_reset variable in a config file I think. Set that to true and restart the app.
If it starts working, just set it back to false. Let me know if that helps.
Nar, src/config.js setting export const CACHE_RESET = true;
npm start gives same error :(
ok, took a little snooping to get this going but i have something working.
- update the line in Store.js in setCurrentDatabase(database) from
this.currentDatabase.title = database.title;
(since ^ this was an initial load and there was no Application Local Storage in the chrome tools) Changed to:
if (database) {
this.currentDatabase.title = database.title;
}
- I progressed however no commands worked, empty result sets. I noticed in Local Storage the currentDatabase had set "firestoreEnabled":false which it should be true. I'm unsure yet why it thought my security key belonged to Realtime DB instead of Firestore. It is indeed for Firestore. Reload and tadaa i get data from my firestore db.
edit above i can see now that there is a dropdown in the app UI next to my project title indicating whether the database is Realtime or Firestore, trust another programmer to toggle a setting like that in App Storage before looking at the UI haha