Yisreal -
Thanks for responding. I’m still confused by your response however:
Note: Since you are handling the Promise returned by the query in the .then() function, it is incorrect to use the await keyword for the query. Just delete await from the line of code
I do not understand why you are saying this is an incorrect use of await . Using the await keyword in this way is purposeful. At least, I am doing this on purpose based on reading the docs and reviewing examples by some of the posts by the moderators here to achieve my goals.
My goal is to publish a back-end function that can be called from my mobile app in order to validate a login against member data in my collection when the user is logging in to the app.
Therefore, the caller of this function blocks until either success or failure is returned. The use of await is to ensure that processing this function continues in a linear fashion so I know at all times whether the requester is a valid user or not and can return a failure or error condition if not.
That’s the whole purpose of using await - the query must complete fully with either an error ( breakNow is set TRUE), an empty query result ( breakNow is set TRUE) or a valid query response ( breakNow is left false and SITMember is initialized).
Therefore, when the promise is completed, it will either return from this function indicating an error in the body of the response, or it will continue on to the “OTHER CODE BELOW”, with a valid SITMember variable initialized.
According to what I read in the docs, and what I have witnessed in my testing, the “OTHER CODE BELOW” DOES NOT get executed prior to the promise being completed. Here is a screenshot for example (“login function continuing after breakNow test” occurs AFTER the query has completed):
Am I still missing something?
I do a lot of Android development and (for example) the lint mechanism within Android Studio is “smart enough” to catch this type of usage and would not flag it as an error. So it seems to me this is one of those times where it is valid to be able to suppress the lint check.
