bwgjoseph / mongoose-vs-ottoman

feature comparison between mongoose and ottoman
0 stars 1 forks source link

$isNull operator #95

Closed bwgjoseph closed 3 years ago

bwgjoseph commented 3 years ago

Hi,

I was testing out $isNull operator but found out that there's either issue with null value, or I am not using it correctly.

const schema = new Schema({
  text: { type: String },
  review: { type: String }
});

ottoman.model('message', schema, modelOptions);

const messageModel = getModel('message');

messageModel.create({ text: null, review: 'test' })
messageModel.create({ text: 'hello', review: 'test' })

messageModel.find({ text: { $isNull: true } });

However, if you create with null as the value, it get stores as a string in database and even if I change the value in database manually to null (not a string null), when I use ottoman to pull the data, it will be converted to string null

Something like this

[I changed the value to non-string null manually] image

[The data from .find still gives string null] image

Hence, there is no way to create a null value and $isNull operator cannot be used if I'm right so far

Thanks!

AV25242 commented 3 years ago

Thanks @bwgjoseph will get back to the team for investigation.

AV25242 commented 3 years ago

Will be fixed with next Beta release.

AV25242 commented 3 years ago

Beta 2.0 is released and should have fixed this issue.