MinimongoError: Key $date must not start with '$'

Hi all, I’m on the downhill, gaining speed with our migration/refactor. Just did a block refactor of a few dozen files, migrating Material UI from v4 to v6; and re-factoring paths of SimpleSchemas from an external package into our main app template.

Getting the following error, with minimal info:

I’ve been doing a lot of path refactoring, but not much in the way of adjusting Minimongo calls. Can we make a guess that this error might be coming from aldeed:collection2@4.0.3? Is this the kind of error that might be thrown from using an .insert() command instead of .insertAsync()?

I know for sure I have seen this error before but I’m not sure from where. May it be possible that client-side minigmongo does not support $date operators?

I have had this in the past. minimongo does not support key that start with $.
On the server side you have probably a document like this : {“$date”: “blabla”} and this fails on the client

But shouldn’t $date keys be automatically covered by EJSON?

Hello I think, it is not the problem of the date, it the problem of the key name.
{“$myKey”: “myValue”} is not working on the client too

Correct, I was just assuming, because Date objects get sent over the wire by DDP as EJSON-stringified version, which uses $date: date.getTime() as values and usually these values are automatically being parsed back when arrived at their desitnation.

1 Like