sgarciac / fuego Goto Github PK
View Code? Open in Web Editor NEWFuego is a command line client for the firestore database (https://firebase.google.com/docs/firestore).
License: GNU General Public License v3.0
Fuego is a command line client for the firestore database (https://firebase.google.com/docs/firestore).
License: GNU General Public License v3.0
The delete command should support an option to delete subcollections recursively
Is there support for Collection Group queries?
https://firebase.googleblog.com/2019/06/understanding-collection-group-queries.html
If there is, do you have an example?
While a dollar sign is valid within a property name, fuego
doesn't appear to allow it:
fuego query myCollection '$archived == true'
Error parsing query '$template' <source>:1:1: invalid token '$'
I believe this line is the one that needs to be changed to allow it.
In Firestore, property names can have any valid UTF-8 character, though I have found issues when using periods, since that's also used as the field separator. But all other characters should be valid here.
I'm using Ubuntu 22.10.
I've been go install github.com/sgarciac/fuego@latest
successfully but noticed there's a Snap.
rm $(which fuego)
sudo snap install fuego
And:
ls -l /snap/fuego
total 0
drwxr-xr-x 4 root root 38 Jun 19 18:44 16
lrwxrwxrwx 1 root root 2 Oct 11 09:58 current -> 16
ls -l /snap/fuego/16
total 0
drwxr-xr-x 2 root root 28 Jun 19 18:44 bin
drwxr-xr-x 2 root root 32 Jun 19 18:44 meta
ls -l /snap/fuego/16/bin
total 17113
-rwxr-xr-x 1 root root 17523378 Jun 19 18:44 fuego
But:
which fuego
/snap/bin/fuego
ln${HOME}/snap/fuego
folderWhen trying to issue a "getall" command, no matter what I try I get "No help topic for 'ga'"
~/Downloads/fuego_0.20.0_MacOS_64-bit
➜ fuego -c ~/Documents/creds.json ga
No help topic for 'ga'
Hello and thanks for a great project.
Maybe I missed a beat, but is there a way to import a file containing an array of objects? In your documentation, I would like to be able to provide a dogS.json... ^_^
I tried a few ways but none worked....
If I pass though something like "points":0, in my JSON, my Model factory parsing it, thinks that it is a double, not an int. This doesn't happen when I add it via the application which is typed.
Fuego version 0.31.1
Thanks a lot for a great tool!
But (unfortunately) I made a collection with documents in, which then have collections again. And those collections has documents...
Is is possible to query for those collection-document-collection-documents?
Thanks again!
Cheers!
Best regards,
Jens Schwarzer :)
Would it be possible to return the path of the returned documents in the metadata when doing a collection group query?
Took me a while to figure out why it was doing this, but turns out it was due to the go lib this project relies on:
googleapis/google-cloud-go#1715
This was a huge issue for me generating IDs with crazy long values, seem all the latest pre-built versions of fuego are impacted by this
ps -- by the way thank you for adding delete handling!
I expect something like this
fuego -c ./cred.json ga
fuego -c ./cred.json ga /
fuego -c ./cred.json ga root/
Is it possible?
Error happening when exporting a NaN value. Not sure how to map that to a json file but, I think that null should be fine.
Apologies for saying "Thanks!" via an issue but I was unable to find other contact information.
This is a very helpful tool, thank you! I continue to be surprised|disappointed that Google hasn't added this functionality either to the Firebase or Cloud SDK CLIs.
I wrote a CLI for one of my databases but Fuego is more generic and useful.
I'm going to incorporate it into my application deployment script.
Being able to populate a Firestore database is clearly a common and useful facility for e.g. automated deployment|testing.
Thank you!
Please consider adding contact details ;-)
As of today, it only supports the ID of a document. This is specially problematic as it can make pagination useless if the referenced documents change while the pages are being retrieved.
Hi,
i played around with the new firestore emulator and added a branch which switches fuegos test suite over to a local emulator.
At the moment one test is failing with the local emulator. I will raise this with google. Besides this the emulator looks to be much faster and does not need connectivity or a gcp project.
Regards,
Carsten
Hey, is there anyway to enable offline support for this? Would love to see this feature if it is not already available.
Hi chamo.
I wanted to emulate a bulk update with fuego, so I wrote a set command inside a loop. This is my code:
for i in $(jq -r ".[] | .ID" requests.json)
do
fuego set --merge solicitudes $i '{"version": 2}'
done
I'm using jq and bash to run this script. When I use echo $i, it shows all my ids correctly, but when I use the fuego command, it keeps creating new documents with duplicate ids. I tried leaving just one element in the array and it works as expected!
I would like to know what is going on and how to fix it.
Thanks in advance
Hello,
FYI - I've noticed that the batch flag was removed by commits on Aug. 20th. It's still in the Readme.md though, which lead to the following error
2021/11/08 11:47:11 flag provided but not defined: -batch
When I used the Fuego cli to add a new collection or document these changes don't reflect in firestore emulator UI and vice versa.
Step to reproduce:
1- set FIRESTORE_EMULATOR_HOST to localhost:8080
2- run the command: fuego add [collectionName] .collection.json
3- check if collection was added: fuego query [collectionName]
4- go to http://localhost:4000/firestore
Bug:
The changes didn't appear in the emulator UI.
Expected:
All collections added in emulator UI or Fuego CLI should appear in both interfaces.
Hi,
When I try to get a document from a subcollection it doesn't seem to work
Any syntax I try I will usually get a :
Failed to get data.
firestore: nil DocumentRef
I find fuego really helpful, particularly during testing or for getting an emulator sample db up and running quickly, so thanks for writing it!
I personally don't like snap so is there any possiblity of packaging fuego for brew?
I haven't personally packaged anything for brew before, or I'd just send a PR, but if this is something you'd merge and it isn't something you can knock out in 5 minutes, I'd be happy to learn how!
Happy to have found your tool here. I'm working to migrate one db to another, I used the query command to save an array of json objects and this works fine.
$ fuego query someCollection > someCollection.array.txt
Where someCollection.array.txt looks like the following,
[
{ "property": value },
{ "property": value },
{ "property": value }
...
]
Next, I'd like to use the output above to add to a collection e.g.
$ fuego add collection ./someCollection.array.txt
Currently it doesn't seem that this is possible!
Alternatively query might output json
$ fuego query someCollection > someCollection.json
...
{ someCollection:
[
{ "property": value },
{ "property": value },
{ "property": value }
]
}
...
followed by this,
$ fuego add someCollection.json
I'm trying to figure out a way to drop individual properties from documents.
While this would make a property null
fuego set --merge collection/document '{"property.path": null}'
is there a way to drop a one altogether?
Something like
fuego set --merge collection/document '{"property.path": <drop>}'
or
fuego delete collection/document/property.path
We really need more graceful error handling, messages are hideous ;-)
This happened when I tried to install it.
→ go get github.com/sgarciac/fuego
# cloud.google.com/go/firestore
../../go/src/cloud.google.com/go/firestore/query.go:493:8: undefined: "google.golang.org/genproto/googleapis/firestore/v1".StructuredQuery_FieldFilter_IN
../../go/src/cloud.google.com/go/firestore/query.go:497:8: undefined: "google.golang.org/genproto/googleapis/firestore/v1".StructuredQuery_FieldFilter_ARRAY_CONTAINS_ANY
I'm running macOS 10.15 and Go 1.12.6
i follow by steps:
git clone https://github.com/sgarciac/fuego.git
cd fuego
go build .
./fuego --help
but when i run
fuego collections
then error log fuego: command not found. How can I fix it
Would it be possible to add a remove command? Reason being, Google IoT requires a-z or A-Z for device ID's -- so if fuego creates a device and it starts with a number, i need to remove the collection but don't see any way to do that with fuego
The following command (directly taken from the doc)
fuego set --merge Msg_Conversation 8ec617d5-37d4-4841-9678-a22939cf8638 '{"messageCount": 1}'
leads to this error:
Incorrect Usage: flag provided but not defined: -merge
(whithout the --merge flag it set and does not update the database entry)
By the way, thanks for this repo, it's incredibly helpful and usually works great :)
With executing fuego delete col/<non-existing-id>
you do not get an error message.
This could lead to some probems in case of a typo.
Adding an additional flag to enable an 'existence check', could solve the issue.
e.g.
$ fuego delete --check-existence col/<non-existing-id>
Error: Trying to delete non-existing document
I have a document type that includes a DocumentRef.
Is there a way to fuego set
documents that include this field type?
I had a quick look through the code and it's unclear whether it's supported.
If not possible with fuego set
, is there a workaround?
Thanks!
Doing fuego get /absolute/path/to/document
fails with
Failed to get data.
firestore: nil DocumentRef
This should succeed, as this is a correct absolute document path.
Doing fuego get absolute/path/to/document
succeeds (no leading /
)
👋 it looks like 0.34.0 release was not completed (i.e. this action run failed, https://github.com/sgarciac/fuego/actions/runs/5917884582/job/16046657054), raise this issue for some awareness. Thanks!
relates to Homebrew/homebrew-core#139991
Please add get all which should get more than 10 documents by ids
I get the following:
~$ FIRESTORE_EMULATOR_HOST=localhost:9001 fuego collections
Failed to create client.
project id is required to access Firestore
I cant spot anywhere how I can set the project id. What am I doing wrong?
If I save a document with GeoPints data type to a JSON and then I reload it then the new data have 'latitude' and 'longitude' fields instead od GeoPoints
It is currently not possible to query on documents that are field references.
fuego query collection 'ref == "/otherCollection/id"'
returns nothing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.