Skip to content
This repository has been archived by the owner on Nov 24, 2017. It is now read-only.

Add project find option for field projection #4

Merged
merged 1 commit into from
Jan 4, 2016
Merged

Add project find option for field projection #4

merged 1 commit into from
Jan 4, 2016

Conversation

hbakhtiyor
Copy link
Contributor

No description provided.

@@ -126,6 +126,8 @@ export class MongodbDriver implements Driver {
cursor.sort(options.sort);
if (options.snapshot)
cursor.snapshot(options.snapshot);
if (options.project)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about dynamically setting the value to cursor instead of a batch of if statements
something like this

            Object.getOwnPropertyNames(options).forEach(option => {
                if (typeof cursor[option] === 'function') {
                    cursor[option].call(cursor, <any>options[option]);
                }    
            });

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think such dynamic stuff is good

pleerock pushed a commit that referenced this pull request Jan 4, 2016
Add project find option for field projection
@pleerock pleerock merged commit a366d35 into pleerock:master Jan 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants