$elemMatch behavior mismatch with MongoDB
See original GitHub issueSimilar to #227, there seems to be another mismatch for $elemMatch compared to MongoDB behavior.
Specifying $elemMatch as a string is handled by sift when it should not be.
it("should not handle $elemMatch with string value", () => {
expect(
sift({ responsible: { $elemMatch: "Poyan" } })({
responsible: ["Poyan", "Marcus"],
})
).toEqual(false);
});
// --> test case fails, sift called with test-data returns true
Attempting to run the same query against MongoDB returns $elemMatch needs an Object
, which is also what the documentation specifies.
https://docs.mongodb.com/manual/reference/operator/query/elemMatch/
Please advise.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
date - Result mismatch between elem match, and greater than ...
The elem-match is clearly correct. Attached output. MongoDB shell version: 3.2.1 connecting to: test > db.getCollection('ads') ...
Read more >How to match $all and equal to conditions in $elemMatch ...
1) Try: - this selecting 2 documents because $in means OR condition in date field, and $all will not work because date inside...
Read more >$elemMatch (query) — MongoDB Manual
The $elemMatch operator matches documents that contain an array field with at least one element that matches all the specified query criteria.
Read more >$ (projection) — MongoDB Manual
The $elemMatch projection operator takes an explicit condition argument. This allows you to project based on a condition not in the query, or...
Read more >$elemMatch:{$exists: true} - M121 - MongoDB
Looks like the curly braces do not match. I am not to sure that elemmatch … exists give you the expected result.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes good idea 👍
of course!