GithubHelp home page GithubHelp logo

Comments (4)

tsetsoo avatar tsetsoo commented on May 24, 2024 1

I've opened #274 with the initial implementation of the $not operator with regex, functioning as an opposite to $regex.
I'll add a second PR with the implementation of $not-ing a whole expression since that seems a bit trickier

Want to share what you are using? Is it in a state in which other could use it, or it's written more specifically for the purpose at hand?

Unfortunately, it's written for the purpose at hand. One of the main blocker would have been the support for mgo over mongo.
Regardless, I'll open a PR in rest-layer-mongo after I'm finished here, to add support for $not

from rest-layer.

smyrman avatar smyrman commented on May 24, 2024 1

$not-ing a whole expression since that seems a b

To be honest, I am not sure how useful it is to be able to not the whole expression. The docs does state that
{price: {$not: {$gt: 12}}} is not equivalent to{price: {$lte: 12}}, since the prior would match any documents where the price is not set while the latter would not. If this is really the query you want, you could just do {$or: [{price: {$lte: 12}}, {price:{$exists: false}]}, which would be more explicit anyways.

from rest-layer.

smyrman avatar smyrman commented on May 24, 2024

I don't see any reason why this feature could not be added. Please do feel free to create a PR for it.

I am using Mongo DB as storage, but not rest-layer-mongo.

Want to share what you are using? Is it in a state in which other could use it, or it's written more specifically for the purpose at hand?

from rest-layer.

smyrman avatar smyrman commented on May 24, 2024

So at least I am not against only implement $not as an oposite to $regex. An views from you @rs?

For reference: https://docs.mongodb.com/manual/reference/operator/query/not/

from rest-layer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.