Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Compass
Created by Guest
Created on Jun 2, 2020

Cast _id: number to string

Every time I type { _id: 12345 } in the Filter, I get zero results, until I realize that I forgot the quotes. Could Compass automatically convert numeric _id values to strings before running the query?
  • Attach files
  • Guest
    Jun 2, 2020
    If its '_id' you're looking for, your query is wrong. If the value of 'id' is a string, then it has to be enclosed in string as its a string field, otherwise unwanted results can crop up. But for those 'id' fields which have numeric data, and matches with 12345, Compass does return the documents.