-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
[BUG] node.forEach is not a function when using .filter().contains() on [String] field #1600
Comments
Same here, node seems to have a value of |
To add more context, it seems querying/scanning any array is broken |
Same here, node seems have value of true or undefined. Then node.forEach got errors. |
Anyone find a workaround for this? Not being able to query on arrays is a pretty big bug... I decided to store my data slightly different to get around this bug...one of my fields I wanted was an arbitrary array of 1 word string values. I was originally storing it in a string array, but decided to change it to a comma delimited string. Now when I want to search on multiple tags, like find my document where tags contains X or Y or Z, I did something like this:
This gets the desired results on my end, although not preferred. |
+1 |
|
Summary:
Model includes a string array field, with the test data being an array with a single string, attempting to filter query using
contains
results in anode.forEach is not a function
error. Other issue mentioned removing the "default" value, but not using a default here.Code sample:
Schema
Model
General
Current output and behavior (including stack trace):
Error in query TypeError: node.forEach is not a function
at .webpack/handler.js:142378:22
at Array.forEach ()
at traverse (.webpack/handler.js:142372:31)
at .webpack/handler.js:142389:17
at Array.forEach ()
at traverse (.webpack/handler.js:142372:31)
at Function.Item.attributesWithSchema (.webpack/handler.js:142395:5)
at .webpack/handler.js:142561:43
at Array.map ()
at Function.Item.objectFromSchema (.webpack/handler.js:142560:46)
at Object.dynamoPropertyForAttribute (.webpack/handler.js:143127:40)
at utils_1.default.async_reduce (.webpack/handler.js:141677:95)
at .webpack/handler.js:146393:16
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.default_1 [as async_reduce] (.webpack/handler.js:146391:20)
at async Object.requestObject (.webpack/handler.js:141751:60)
at async Query.ItemRetriever.getRequest (.webpack/handler.js:142823:52)
at async .webpack/handler.js:142805:32
at async getAnnouncements (.webpack/handler.js:242371:21)
Expected output and behavior:
Expecting
.filter('[string array field]').contains('string')
to workEnvironment:
Operating System: serverless-offline 8.8.1 Lambda
Operating System Version:
Node.js version (
node -v
): 16.18NPM version: (
npm -v
): yarn 1.22Dynamoose version: 3.2.0
Other information (if applicable):
Worked fine in Dynamoose v2, issue appeared in Dynamoose v3
Other:
The text was updated successfully, but these errors were encountered: