Giter VIP home page Giter VIP logo

Comments (9)

michaeljota avatar michaeljota commented on July 18, 2024

How you would assume 'find' will behave?

from camo.

scottwrobinson avatar scottwrobinson commented on July 18, 2024

That's a good question. There isn't really a great reason why load is used instead of find. I thought loadMany and loadOne were more descriptive of what the methods were actually doing, as opposed to find and findOne.

Also, at that time I had planned on supporting many more DB backends (and I would still like to, eventually), so I didn't want the API to seem like it was just for Mongo.

Looking back on it, there probably wasn't good enough reason to make the change. If enough people want the loadMany and loadOne to change to find and findOne, I'd be happy to do it.

Thanks!

from camo.

lukeshiru avatar lukeshiru commented on July 18, 2024

If enough people want the loadMany and loadOne to change to find and findOne, I'd be happy to do it.

Then, here is my +1 👍

from camo.

wollnyst avatar wollnyst commented on July 18, 2024

Here's my +1.

find and findOne are not only related to Mongo. Most ORM wrappers such as ActiveRecord (Rails), EntityFramework (ASP.NET) or GORM (Grails) use find.

from camo.

minecrawler avatar minecrawler commented on July 18, 2024

Why not support both? You might think about arguing that "your" API is loadOne and loadMany. But by popularity-vote, you would allow aliases, like findOne and find for easy usage. That's just some idea~

BTW, I also +1 :)

from camo.

scottwrobinson avatar scottwrobinson commented on July 18, 2024

Thanks for everyone's input!

@minecrawler while I'd like to support loadOne and loadMany as aliases, I think this will just add confusion for new Camo users. Would like to keep the API as simple as possible.

Based on feedback I'll be changing loadOne and loadMany to findOne and find, respectively. Both loadOne and loadMany will be deprecated, although they'll be kept as aliases until at least the 1.0 release.

Thanks again!

from camo.

scottwrobinson avatar scottwrobinson commented on July 18, 2024

This also applies to loadOneAndUpdate and loadOneAndDelete as well. Here is the full list of changes to be made:

  • loadOne --> findOne
  • loadMany --> find
  • loadOneAndUpdate --> findOneAndUpdate
  • loadOneAndDelete --> findOneAndDelete

from camo.

lukeshiru avatar lukeshiru commented on July 18, 2024

I'll be updating the .d.ts file in DefinitelyTyped to match this change, then :)

from camo.

scottwrobinson avatar scottwrobinson commented on July 18, 2024

@lucasmciruzzi thanks! The changes should be up later today.

from camo.

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.