Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enumerate type counts for multiple types; enable secondary reads #104

Merged
merged 4 commits into from Dec 8, 2015

Conversation

predictive
Copy link
Contributor

This keeps a count of how many of each type is found for a given field, to assist in making decisions about schema changes.

The user can now pass slaveOk=true to mongo when reading from a secondary replica set member.

Note: This changes the JS type of 'types' from Array to Object, which could break programs parsing the JSON output of Variety:

[
        {
                "_id" : {
                        "key" : "_id"
                },
                "value" : {
                        "types" : {
                                "ObjectId" : 119
                        }
                },
                "totalOccurrences" : 119,
                "percentContaining" : 100
        },
        {
                "_id" : {
                        "key" : "lat"
                },
                "value" : {
                        "types" : {
                                "Number" : 119
                        }
                },
                "totalOccurrences" : 119,
                "percentContaining" : 100
        },
        {
                "_id" : {
                        "key" : "lon"
                },
                "value" : {
                        "types" : {
                                "String" : 1,
                                "Number" : 118
                        }
                },
                "totalOccurrences" : 119,
                "percentContaining" : 100
        }
]

@todvora
Copy link
Contributor

todvora commented Dec 3, 2015

Hi Jeff,
Thanks for your PR. It looks like useful features to have. Let me check the source code and adapt test cases.

What do others think?

Best regards,
Tomas

todvora added a commit that referenced this pull request Dec 7, 2015
@todvora
Copy link
Contributor

todvora commented Dec 7, 2015

I just created new branch and adapted the tests to this PR. See https://github.com/variety/variety/tree/objectrocket-master.

How about a merge, @JamesCropcho? Any comments?

@JamesCropcho
Copy link
Member

Hello Jeff and Tomáš:

Jeff, thank you so much for your contribution to Variety. In addition to hopefully benefiting you, it will surely benefit the few thousand Variety users around the world.

I would have like to receive one PR for the slaveOk and one for the type enumeration, but I won't be nearly picky enough to request resubmission. (Seriously, thank you!)

Tomáš, I see your branch passes the test suite, yet we want to semantically give credit to Jeff, i.e. merge his PR so there is a paper trail (ideally). How about you merge his PR, then merge your branch into master—does that sound like a plan?

Best to You Both,
James Cropcho

todvora added a commit that referenced this pull request Dec 8, 2015
Enumerate type counts for multiple types; enable secondary reads
@todvora todvora merged commit 18ec4c8 into variety:master Dec 8, 2015
todvora added a commit that referenced this pull request Dec 8, 2015
@todvora
Copy link
Contributor

todvora commented Dec 8, 2015

Hi,
Merged and cherry-picked the test commits from the branch. Tests are passing on master.

Thank you!

@JamesCropcho
Copy link
Member

Looking great, you two. Mission accomplished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants