Error: Parse error: bad $in value

This is the error I get. I haven’t changed my code. It suddenly stopped working. Any idea How to solve this?

this is the full error:

error: Parse error: bad $in value {"code":107,"stack":"Error: bad $in value\n at transformConstraint (/root/parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:1018:19)\n at transformQueryKeyValue (/root/parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:417:33)\n at transformWhere (/root/parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:469:17)\n at MongoStorageAdapter.find (/root/parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js:497:59)\n at /root/parse/node_modules/parse-server/lib/Controllers/DatabaseController.js:1162:33\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)"}

1 Like

I think I figured out.
By looking at official mongodb docs
$in operator is equalivent of containedIn parameter of parse server.

I was passing an object to this parameter instead of array. When I changed it to equalTo, problem solved.

But this is strange. Same code was working almost 3 months. Suddenly Ä°ts stopped. Anyway problem solved.

2 Likes

Thanks, I had the same issue and this fixed it. Passing a string to “containedIn” was working since I started this project, but doesn’t work anymore. Passing an array with a single string in it does.

2 Likes

I’ve reported this as a documentation issue - Parse.Query.containedIn documentation issue · Issue #1783 · parse-community/Parse-SDK-JS · GitHub