I created a custom EJSON data-type. Transfer from client to the server works as expected, the server constructs the correct data-type. However, if I store an object into the database, it is always stored as a plain object. Mongo does not store any additional metadata about the type as I would have expected.
To make sure that my custom code is not interfering, I took the sample code from here:
and just tried to store an Address object to a Mongo collection, using:
var myAddress = new Address("San Francisco", "CA"); var addresses = new Mongo.Collection('addresses'); addresses.insert(myAddress);
But this resulted in:
Error: Only plain objects may be inserted into MongoDB
I always thought that storing custom data types right inside MongoDB was one of the central use-cases of EJSON?