GithubHelp home page GithubHelp logo

Comments (6)

1602 avatar 1602 commented on August 18, 2024

Yep, just need to extend order feature to work with direction option.

Thanks,
Anatoliy

On 28.02.2012, at 10:25, [email protected] wrote:


MongooseAdapter.prototype.all = function all(model, filter, callback) {
  ...
   if (filter.order) {
       query.asc(filter.order); //direction is hardcoded
   }
   ...
};

is there an easy way to patch this issue and define findOne method?

Thanks


Reply to this email directly or view it on GitHub:
#38

from jugglingdb.

1602 avatar 1602 commented on August 18, 2024

Maybe this is undocumented mongoose feature, but for my test it works as expected when I specify sort direction:

User.all({order: 'email DESC'}, console.log);

Let me know if you have any problems with mongoose adapter. I've only fixed redis adapter to hook this feature, all others working just fine.

from jugglingdb.

TinNT avatar TinNT commented on August 18, 2024

Thanks for your reply, I tried to install latest release of mongoose and jugglingdb, but it didn't help, the issue is still there, here is the details


➜  node_modules  npm install mongoose
[email protected] ./mongoose 
├── [email protected]
└── [email protected]
➜  node_modules  npm install jugglingdb
[email protected] ./jugglingdb 
└── [email protected]


------------

User.all({order: 'email DESC'}, function(err, users){
   users.forEach(function(user){
     console.log(user.email);
   })
});

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

note: order by email DESC did not work
---------------

User.all({order: 'email'}, function(err, users){
   users.forEach(function(user){
     console.log(user.email);
   })
});

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]



Thanks again.

from jugglingdb.

1602 avatar 1602 commented on August 18, 2024

Both features implemented now: findOne, DESC, ASC sortings for mongoose

from jugglingdb.

TinNT avatar TinNT commented on August 18, 2024

Awesome!!!

Thank you.

from jugglingdb.

giano avatar giano commented on August 18, 2024

thanks!

from jugglingdb.

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.