Chili Pepper Design

Web development relleno

MongoDB Nested Array Wildcard Search Query

| Comments

Official bugs: https://jira.mongodb.org/browse/SERVER-1248 https://jira.mongodb.org/browse/SERVER-267

Stack Overflow questions: http://stackoverflow.com/questions/8840342/mongodb-dot-notation-wildcard http://stackoverflow.com/questions/6179871/mongodb-wildcard-in-the-key-of-a-query http://stackoverflow.com/questions/9899740/mongo-querying-for-values-nested-in-child-arrays-where-keys-are-variable http://stackoverflow.com/questions/8635911/mongodb-query-against-value-in-nested-array http://stackoverflow.com/questions/8901977/mongodb-nested-array-search http://stackoverflow.com/questions/1853735/mongodb-nested-sets https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/z0k3AnxxC_0

Current strategies: -have a known, fixed index -make the data you want to query the index, and use ‘$exists’ -$elemMatch? http://docs.mongodb.org/manual/reference/projection/elemMatch/#_S_elemMatch – this returns a subset of the document with “projection”, which can then be queried -a $where search function (performance is bad?) -mapreduce? -new aggregator framework? -wait for official support – check if the basic support exists in the new versions? What about arbitrarily deep tree structures? -really out of luck I think - denormalize the data: store at top-level a list of all the terms you might want to search for -don’t nest in the document, try some of these patterns : http://docs.mongodb.org/manual/tutorial/model-tree-structures/

Comments