[DOCS-8014] Comment on: "manual/reference/operator/query/regex.txt" Created: 02/Jun/16 Updated: 03/Nov/17 Resolved: 14/Jun/16 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 01112017-cleanup |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Docs Collector User (Inactive) | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | collector-298ba4e7 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Location: https://docs.mongodb.com/manual/reference/operator/query/regex/#op._S_regex |
||
| Participants: | |
| Days since reply: | 7 years, 36 weeks, 6 days ago |
| Description |
|
how to find a data such as other DB languange like ,type is int ,not string. |
| Comments |
| Comment by Ravind Kumar (Inactive) [ 02/Jun/16 ] | ||||
|
Hello, If you are using MongoDB 3.2+, then you might consider using the $type operator. $type allows you to evaluate if a field is of a specific BSON type. You can see the supported types here The $not operator allows you to negate the result of $type to achieve the result you are looking for. For example, given the following dataset:
The following query would return documents where x is not a string
Similarly, the following query returns documents where X is an int
Please note that MongoDB differentiates between 32-bit integers (int), 64 bit integers (long), and double values. If you wanted to search for values of x that could be an int, long, or double, use the number alias. Please see this page if you would like more examples to work from. |