e***@hrs-pd.de
2018-02-02 13:57:14 UTC
Hi,
In one collection we have documents which look like this:
{
"A" : [],
}
OR
{
"A" : [
{
"_id" : 1,
"Name" : "ASDF"
},
{
"_id" : 2,
"Name" : "GHJKL"
}
],
}
So we need all the distinct values of this array for our UI.
Running
db.getCollection('X').distinct('A')
actually works fine and returns the values we expect. If we then add an
index on this Field ( db.X.createIndex({"A":1,{Name:"IX_A"}) and run this
query again, there is suddenly an item undefined:
[
undefined,
{
"_id" : 1,
"Name" : "ASDF"
}, ...
]
So how can we get rid of this undefined item in the index?
Thanks!
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/0589a6f5-4a8e-4c63-99e3-b954e69f30c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
In one collection we have documents which look like this:
{
"A" : [],
}
OR
{
"A" : [
{
"_id" : 1,
"Name" : "ASDF"
},
{
"_id" : 2,
"Name" : "GHJKL"
}
],
}
So we need all the distinct values of this array for our UI.
Running
db.getCollection('X').distinct('A')
actually works fine and returns the values we expect. If we then add an
index on this Field ( db.X.createIndex({"A":1,{Name:"IX_A"}) and run this
query again, there is suddenly an item undefined:
[
undefined,
{
"_id" : 1,
"Name" : "ASDF"
}, ...
]
So how can we get rid of this undefined item in the index?
Thanks!
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/0589a6f5-4a8e-4c63-99e3-b954e69f30c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.