Comments (9)
How you would assume 'find' will behave?
from camo.
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.
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.
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.
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.
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.
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.
I'll be updating the .d.ts file in DefinitelyTyped to match this change, then :)
from camo.
@lucasmciruzzi thanks! The changes should be up later today.
from camo.
Related Issues (20)
- Is camo still maintained? HOT 1
- Why can't there just be an upsert method on Document?
- [TypeError: Class constructor Document cannot be invoked without 'new'] when using ts-node
- Support for non-required embedded documents
- Support for reference document inside embedded document
- Info about the project HOT 3
- batch insert
- Pull request for use with react-native-local-mongodb? HOT 1
- optional modules not optional HOT 1
- RangeError: Maximum call stack size exceeded when trying to write to non-existent field HOT 1
- find() not returning all results HOT 1
- Hacktoberfest HOT 1
- Awesome Idea, Need some features HOT 1
- hasMany, hasOne, belongsTo support
- Support for "mongodb+srv" connection URL
- Double request needed to delete operation
- MongoDB collation
- Marpat: find({}, {population: true}) doesn't work HOT 1
- MongoDB's new Options format
- Raw query support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camo.