[DOCS-16190] Document behavioral change for $mod Created: 08/Jun/23  Updated: 30/Oct/23  Resolved: 12/Jul/23

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Minor - P4
Reporter: Peter Volk Assignee: Alison Huh
Resolution: Fixed Votes: 0
Labels: quick-win, server-docs-bug-bash
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 32 weeks ago

 Description   

In https://www.mongodb.com/docs/manual/reference/operator/query/mod/ the behaviour of $mod with Infinity and NaN are documented. Yet what is missing is that the function will return false in the case of Infinity as input from the document. 



 Comments   
Comment by Peter Volk [ 28/Jun/23 ]

Hi alison.huh@mongodb.com 

 

you can use the following sequence:

 

db.mod_test.insertMany([{"a": "infinity"}])
db.mod_test.find({a: {$mod : [1,2]}})

The find command will not error out and will not return any data as $mod against infinity returns a boolean false. 

 

Comment by Alison Huh [ 27/Jun/23 ]

Hi peter.volk@mongodb.com, could you share an example that shows this behavior? Upon testing on my own instance, it seems to just error and not return false.

Generated at Thu Feb 08 08:14:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.