[DOCS-14355] Incorrect regex example in schema validation documentation Created: 13/Apr/21 Updated: 30/Oct/23 Resolved: 21/Nov/22 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual, Server |
| Affects Version/s: | None |
| Fix Version/s: | Server_Docs_20231030 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Raymond Hu | Assignee: | Jeffrey Allen |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | reopened, triage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: | |
| Days since reply: | 1 year, 8 weeks, 2 days ago |
| Epic Link: | DOCSP-11701 |
| Story Points: | 1 |
| Description |
DescriptionHi team, I discovered an incorrect regex example in our documentation regarding schema validation. https://docs.mongodb.com/manual/core/schema-validation/#accept-or-reject-invalid-documents ``` email: { bsonType : "string", pattern : "@mongodb\.com$", description: "must be a string and match the regular expression pattern" }``` This part may lead the readers to believe that the regex expression defined in "pattern" will match any string ends with "@mongodb.com", however, the regex above will also match "@mongodbxcom" or "@mongodbbcom" The correct expression when used with "pattern" should be "@mongodb\\.com$" because the `\` must be escaped and replaced with \\ in a JSON string.
Test 1: shows the current example accepts "@mongodbb.com" ```
``` Test 2: shows with the correctly escaped '\' it won't accept "@mongodbb.com", and accepts only "@mongodb.com" ``` MongoDB Enterprise > db.getSiblingDB('TSA').test.drop() true
Best regards,
Raymond Scope of changesImpact to Other DocsMVP (Work and Date)Resources (Scope or Design Docs, Invision, etc.) |
| Comments |
| Comment by Githook User [ 12/Dec/22 ] |
|
Author: {'name': 'Kenneth P. J. Dyer', 'email': '93145796+kennethdyer@users.noreply.github.com', 'username': 'kennethdyer'}Message: DOCSP-25509 $shardedDataDistribution (#2150)
Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com> Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com>
Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
Co-authored-by: jmd-mongo <73852296+jmd-mongo@users.noreply.github.com>
Co-authored-by: Kyle Suarez <ksuarz@gmail.com> Co-authored-by: Kyle Suarez <ksuarz@gmail.com>
Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com> |
| Comment by Githook User [ 12/Dec/22 ] |
|
Author: {'name': 'Jeff Allen', 'email': 'jeffrey.allen@10gen.com', 'username': 'jeff-allen-mongo'}Message: (
|
| Comment by Githook User [ 29/Nov/22 ] |
|
Author: {'name': 'Kenneth P. J. Dyer', 'email': '93145796+kennethdyer@users.noreply.github.com', 'username': 'kennethdyer'}Message: DOCSP-25509 $shardedDataDistribution (#2150) (#2210)
Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com> Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com>
Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
Co-authored-by: jmd-mongo <73852296+jmd-mongo@users.noreply.github.com>
Co-authored-by: Kyle Suarez <ksuarz@gmail.com> Co-authored-by: Kyle Suarez <ksuarz@gmail.com>
Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com> Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com> |
| Comment by Githook User [ 29/Nov/22 ] |
|
Author: {'name': 'Kenneth P. J. Dyer', 'email': '93145796+kennethdyer@users.noreply.github.com', 'username': 'kennethdyer'}Message: DOCSP-25509 $shardedDataDistribution (#2150)
Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com> Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com>
Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
Co-authored-by: jmd-mongo <73852296+jmd-mongo@users.noreply.github.com>
Co-authored-by: Kyle Suarez <ksuarz@gmail.com> Co-authored-by: Kyle Suarez <ksuarz@gmail.com>
Co-authored-by: Jordan Smith <45415425+jordan-smith721@users.noreply.github.com> |
| Comment by Githook User [ 21/Nov/22 ] |
|
Author: {'name': 'Jeff Allen', 'email': 'jeffrey.allen@10gen.com', 'username': 'jeff-allen-mongo'}Message: (
|
| Comment by Githook User [ 21/Nov/22 ] |
|
Author: {'name': 'Jeff Allen', 'email': 'jeffrey.allen@10gen.com', 'username': 'jeff-allen-mongo'}Message: (
|
| Comment by Raymond Hu [ 19/Nov/22 ] |
|
jeffrey.allen@mongodb.com Thank you for the update! The new regex pattern is correct. |
| Comment by Sarah Olson [ 01/Nov/22 ] |
|
Thanks for the confirmation, raymond.hu@mongodb.com! |
| Comment by Education Bot [ 31/Oct/22 ] |
|
Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you! |