开发者

Can you query MongoDB for any properties with a given value?

I'm beginning to play around with MongoDB and I'm wondering if it's possible to query the datastore for any property with a particular value.

So instead of:

db.foo.find({'color':'red'})

I'm looking to see if you can do something like:

db.foo.find开发者_Go百科({'%':'red'})

Is that possible? Is there a syntax for wildcarding the property slot? I tried using a regular expression but that gave me an error.


It is possible to query the property names (key names) with map reduce. See here: MongoDB Get names of all keys in collection

Maybe it is possible to write a map reduce function that queries on the combination of a property name and its value with JavaScript?

But why do you need this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜