Questions tagged [multikey]
78 questions
2
votes
2 answers
Mongo custom multikey sorting
Mongo docs state:
The Mongo multikey feature can automatically index arrays of values.
That's nice. But how about sorting based on multikeys? More specifically, how to sort a collection according to array match percentage?
For example, I have a…

katspaugh
- 17,449
- 11
- 66
- 103
2
votes
2 answers
Java 8 Grouping with Multiple Keys
I am looking for some help in grouping a list of objects from a list with multiple keys.
Basically, I have a list of users which contains a list of their orders and I want to be able to group them together using UserName and Address as the…

coderob1996
- 25
- 6
2
votes
0 answers
Is there a class that stores one value under 2 different keys?
I have an SQL table "Stats" with 3 columns, id (int), name (varchar), and display (varchar). In my program, I want to cache the information pulled from that table when it's needed, so I'm using guava's LoadingCache.
private static final…

JacobRuby
- 21
- 3
2
votes
1 answer
indexing large array in mongoDB
according to mongoDB documentation, it's not recommended to create multikey index for large arrays, so what is the alternative option for that?
I want to notify my app users whenever one of their contacts also start using the app, so I have to…

zigy
- 69
- 1
- 4
2
votes
1 answer
Indexing MongoDB array position queries
I'd like to build an index that supports queries against specific array element positions.
Given several million documents with arrays of values:
db.foo.insert({ array: [true, false, null, true] })
db.foo.insert({ array: [false, null, true, true]…

MZS
- 573
- 4
- 12
2
votes
1 answer
About dual key concurrent hashmap in java
I need dual key concurrent hashmap.
My first try is just using java.util.concurrent.ConcurrentHashMap. Like this
ConcurrentHashMap map = new ConcurrentHashMap<>();
map.put("key1" + "|" +"key2", "value");
String vaule = map.get("key1"…

KI-YOUNG BANG
- 199
- 1
- 10
2
votes
1 answer
MongoDB multikey index performance
Background
I have a collection of users with structure of documents like this:
{
"_id" : ObjectId("54e61137cca5d2ff0a8b4567"),
"login" : "test1",
"emails" : [
{
"email" : "test1@example.com",
"is_primary"…

lis-dev
- 192
- 8
2
votes
2 answers
Why is a single index faster than a compound index in a query for two keys? (MongoDB, multi-key)
I have created 4 indexes to test query performance in my collection when quering for two fields of the same document, one of which is an array (needs a multi-key index). Two of the indexes are single and two compound.
I am surpised because of…

Oscar Moya
- 47
- 1
- 11
2
votes
1 answer
Multi-key Indexing on an Entire Array
MongoDB's docs explain multi-key indexing. Consider this comment document.
{
"_id": ObjectId(...)
"title": "Grocery Quality"
"comments": [
{ author_id: ObjectId(...)
date: Date(...)
text: "Please expand the cheddar selection." },
…

Kevin Meredith
- 41,036
- 63
- 209
- 384
2
votes
1 answer
Multi string-element sort on Ruby hash, first key descending, second key ascending
Given the following array of hashes:
values = [
{"one"=>"BA", "two"=>"AAB"},
{"one"=>"AA", "two"=>"BBA"},
{"one"=>"AA", "two"=>"BCB"},
{"one"=>"AA", "two"=>"ABA"},
{"one"=>"BC", "two"=>"AAC"},
{"one"=>"AC", "two"=>"AAB"},
{"one"=>"AC",…

Richard Nienaber
- 10,324
- 6
- 55
- 66
1
vote
1 answer
MongoDB Index Array only partly working
I know there is already a lot on this subject out there, but none of the questions do help me going on.
I have a File-Upload-System via GridFS which generates documents like this:
{ "_id" : ObjectId( "4f3723607b5c0b8d01060000" ),
"filename" :…

Merc
- 4,241
- 8
- 52
- 81
1
vote
1 answer
using series.map with multi key dictionary
I have a Python dictionary with 3 keys which I created using the following code. the dictionary is very large - approximately 100,000 rows.
t1=list(zip(df.Col1, df.Col2,df.Col3))
d_dict= dict(list(zip(t1,df.Col4)))
I now have a separate dataframe…

LLONDON
- 11
- 1
- 2
1
vote
1 answer
Java Hadoop MapReduce Chaining Job
I have some code that correctly selects the source and the highest weight. I can't seem to pull the target column in as well. could someone point me in the right direction? I've never used java before. I think the reducer function needs to return a…

zelda26
- 489
- 2
- 10
- 33
1
vote
1 answer
Multikey dictionary from 2d array
Trying to create multikey dictionary with values from the list, where keys of the dictionary are first column and first row values, except the empty cells.
The code below doesn't return the expected result. I also tried with map function and list…

Rokson
- 11
- 4
1
vote
2 answers
MongoDB Indexes for dynamic sub-fields
MongoDB 3.0.2. Documents examples:
{ "_id" : NumberLong(1), Categories : { "123" : { "Shows" : NumberLong(7), "Clicks" : NumberLong(0) }, "221" : { "Shows" : NumberLong(33), "Clicks" : NumberLong(12) } } }
{ "_id" : NumberLong(2), Categories : {…

slava
- 791
- 1
- 11
- 26