如何在MongoDB中查找字段为NaN的所有文档? [英] how do I find all documents with a field that is NaN in MongoDB?

查看:1015
本文介绍了如何在MongoDB中查找字段为NaN的所有文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除所有NaN的地理空间字段,以便可以正确索引MongoDB.

I want to delete all geospacial fields that are NaN so I can properly index my MongoDB.

我如何找到所有具有此功能的文档?

How do I find all documents that have this though?

db.collection.find( { field: {$not: { $type: 1 } } })

由于NaN是Number类型,因此无法正常工作.

won't work since NaN is of type Number.

推荐答案

db.collection.find( { field: NaN })

虽然我找不到任何文档,但实际上可以工作

actually works although I couldn't find any documentation on it

这篇关于如何在MongoDB中查找字段为NaN的所有文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆