Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean Query in Where-Clause? #1364

Closed
Meistercoach83 opened this issue Oct 21, 2018 · 6 comments
Closed

Boolean Query in Where-Clause? #1364

Meistercoach83 opened this issue Oct 21, 2018 · 6 comments
Assignees
Labels
api: firestore Issues related to the Firestore API. type: question Request for information or clarification. Not an issue.

Comments

@Meistercoach83
Copy link

Meistercoach83 commented Oct 21, 2018

Hi! I´d like to query my firestore db with this statement:

$query = $this->applicationCollection->where('isCurrentApplication', '=', true);

But when I´m trying to do that, I get the following error:

'InvalidArgumentException' with message 'Value cannot be a Google\Cloud\Firestore\FieldValue value.

Is that a bug?

@jdpedrie jdpedrie added type: question Request for information or clarification. Not an issue. api: firestore Issues related to the Firestore API. labels Oct 21, 2018
@jdpedrie
Copy link
Contributor

Hi @Meistercoach83, I'm sorry to hear you're having trouble!

I've not been able to trigger the error using the code you shared. If you've shared a subset of the query, could you share the full query call? What version of PHP are you using?

If you have a full stacktrace for the exception, could you please share that as well?

@Meistercoach83
Copy link
Author

Hi, sorry for the late response - I´m in a reha for 3 weeks.

I´m running my script in the AppEngine. How can I create a full stacktrace? There´s just this short error message displayed and it´s my full query call...

@jdpedrie
Copy link
Contributor

Hi @Meistercoach83. I've tried running an equivalent query in AppEngine, and still cannot replicate this. I've also tried all the PHP versions we support without success. Given the code you provided, I don't see how the error you report can arise from that where() call. Are you certain there are no other where() calls with different arguments, or perhaps any of the cursor method calls ('startAt(), startAfter(), endAt(), endBefore()`)?

A stacktrace will help you in verifying the source of the problem. Does the error replicate for you locally (i.e. not in the appengine environment)? If it does, you should be able to obtain a stacktrace there more easily.

@Meistercoach83
Copy link
Author

Meistercoach83 commented Nov 5, 2018

Hi! it´s just this function:

public function getCurrentApplication()
  {
    $query = $this->applicationCollection->where('isCurrentApplication', '=', true);
    $snapshot = $query->documents();
> Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Value cannot be a `Google\Cloud\Firestore\FieldValue` value.' in /base/data/home/apps/******/1.413405408193192939/vendor/google/cloud/Firestore/src/Query.php:279 Stack trace: #0 /base/data/home/apps/******/1.413405408193192939/php/application.class.php(17): Google\Cloud\Firestore\Query->where('isCurrentApplic...', '=', true) #1 /base/data/home/apps/******/1.413405408193192939/php/match/matchplan2gcal.php(43): myApp->getCurrentApplication() #2 {main} thrown in /base/data/home/apps/******/1.413405408193192939/vendor/google/cloud/Firestore/src/Query.php on line 279 

@jdpedrie
Copy link
Contributor

jdpedrie commented Nov 5, 2018

Hi @Meistercoach83. It looks like the older version of google/cloud you're using has a bug which is causing the issue you're reporting. The issue was fixed in v0.74.0. I'd suggest making sure you upgrade to at least that version, and preferably the most recent version!

In case you're not aware, we also provide a package which contains only the Firestore client. It can be installed by requiring google/cloud-firestore. If you're not using other Google Cloud APIs, installing only Firestore will keep you from including a lot of dependencies you don't need. If you choose to use google/cloud-firestore, be sure to install version 0.13.0 or higher to get the fix for your problem.

Sorry for the trouble, and apologies that I didn't find the source of the problem sooner. The full error you shared helped quite a bit. :)

@jdpedrie
Copy link
Contributor

@Meistercoach83 I think this was resolved. If you happen to still be having issues, please feel free to re-open this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the Firestore API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants