Skip to content
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 with != #149

Open
lc-mm opened this issue May 2, 2023 · 0 comments
Open

Bug with != #149

lc-mm opened this issue May 2, 2023 · 0 comments

Comments

@lc-mm
Copy link

lc-mm commented May 2, 2023

We are having an issues with the != operator. When we try to query where _id!=64514704b973cc48c724d563 instead of resolving this as $ne it instead is turning into $not which happens at this line

The reason this triggers is becasue we have a caster for this field:

import { ObjectId } from 'mongodb';
const aqpOptions = {
  casters: {
    mongoId: (val) => new ObjectId(val),
  },
  castParams: {
    _id: 'mongoId',
  },
};

What I would like to know is when is the $not operator intended to be added? In the documentation and examples I only see it next to regex values. Are there other cases where $not should be added as well, or would it be safe to also check value instanceof RegExp before using that condition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant