Reputation: 107
SO I have a collection set at this :
rootCollection -> document1 -> "field" : {"flag":true, "name" : "test1"}
rootCollection -> document2 -> "field" : {"flag":false, "name" : "test2"}
rootCollection -> document3 -> "field" : {"flag":true, "name" : "test3"}
So my document contains a field "field1" which is an object.
I would like to make a query to fetch the valid documents where my "flag" is set as true.
Hence returning in this example, only document 1 and 3
How can I achieve that ?
Upvotes: 0
Views: 4931
Reputation: 2367
Is this what you're looking for ?
documents := client.Collection("collection_name")
documents_that_are_true = documents.Where("field.flag", "==", true)
Upvotes: 7
Reputation: 599571
That should be fairly simple:
query := client.Collection("rootCollection").Where("field.flag", "==", true)
Upvotes: 1