Skip to content

Commit 2561a68

Browse files
authored
Merge pull request #505 from M4xymm/RDBC-969
RDBC-969 Query with whereIn using the exact parameter doesn't work
2 parents bf80fc7 + 35287b3 commit 2561a68

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/Documents/Session/AbstractDocumentQuery.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,10 @@ export abstract class AbstractDocumentQuery<T extends object, TSelf extends Abst
10541054
"In",
10551055
fieldName,
10561056
this._addQueryParameter(
1057-
this._transformCollection(fieldName, AbstractDocumentQuery._unpackCollection(values))));
1057+
this._transformCollection(fieldName, AbstractDocumentQuery._unpackCollection(values))
1058+
),
1059+
new WhereOptions({exact})
1060+
);
10581061
tokens.push(whereToken);
10591062
}
10601063

test/Ported/QueryTest.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,24 @@ describe("QueryTest", function () {
264264
assert.strictEqual(results.length, 1);
265265
});
266266

267+
// RavenDB-25553 - dynamic queries with exact search in whereIn clause are not working as expected
268+
it.skip("query with where in and exact", async () => {
269+
const session = store.openSession();
270+
271+
const user4 = Object.assign(new User(), {name: "tarzan"});
272+
273+
await session.store(user4, "users/4");
274+
await session.saveChanges();
275+
276+
const resultsExactTarzan = await session.query(User).whereIn("name", ["Tarzan"], true).all()
277+
const resultsExactLowercase = await session.query(User).whereIn("name", ["tarzan"], true).all()
278+
const resultsNonExact = await session.query(User).whereIn("name", ["tarzan"]).all()
279+
280+
assert.strictEqual(resultsExactTarzan.length, 1);
281+
assert.strictEqual(resultsExactLowercase.length, 1);
282+
assert.strictEqual(resultsNonExact.length, 2);
283+
});
284+
267285
it("query with where between", async () => {
268286
const session = store.openSession();
269287
const results = await session.query(User)

0 commit comments

Comments
 (0)