I'm having trouble getting distinct to work with an un-keyed array
element.
I can search on the element successfully, referencing it by array
position:
c.find({LogPingback_12: {$exists: true}, 'LogPingback_12.2':
'pingback:error'}).sort({$natural: -1}).limit(1)
{ "_id" : ObjectId("4bce18753fa4d3b3b25f6314"), "LogPingback_12" : [
"http://www.mondodisconti.it/foo",
"
Hi,
I have a collection who have many documents looks like this :
{
"_id" : 1,
"animal_array" : [{
"type" : "dog",
"diet" : "meat"
},
{
"
I am having a requirement to create a search query of parameters and send it to server. I have created the drop downs from where the user will populate the values.�
� � �Below is the code on the UI: (�I am working with Angularjs 1.4.7)
� � � � � � � � � �
� � � � � � � � � � �
� � � � � � � � � � � � classification
� � � � � � � � � � � �
� � � � � � � � � � �
� � � � � � � � � � �
� � � � � � � � � � � �
Hi, I want to add a new element to an array in php, is the following way the
correct way? assuming that $chk is an array and $ID contains a value.
$j = count($chk);
$j++;
$chk[$j] = $ID;
Hey guys,
today I stumbled over a problem. I have a relation between users and events
where "event" holds a collection of "user"s to describe "invites".
I chose a reference based one-to-many design as I need "user" to also be
its own collection and don't want to sync changes in one user document to
the same entry in the event's "invites" collection.
Now based on the mongodb docs this
Hi,
1.
Is it possible to get index of an element in an array.
for e.g. :
{
"color":["Red","Green","Blue"]
}
how can i get "Green" index in the color array?
2.
In update we use $ to specify the position in an array. Is it possible to get an element in an specific position of the array?
i.e. db.collection.find({},{"color.1":1});
it should return
{
"color":["Green"]
}
Is it possible?
Is there a good way do drop an element from an array?
Alex Shi
Hi,
Is there a way to quickly search an element inside an array on mongodb without using for loop, so for example I have this input array a = ["dog", "cat", "tiger"] and I want to quickly search among this collection :
{
"_id" : ObjectId("4f6fe6a30cf2bc9bcb96f241"),
"animals" : {
"species" : ["cat",
"
I know that MongoDB supports the syntax find{array.0.field:"value"}, but I
specifically want to do this for the last element in the array, which means
that I don't know the index. Essentially, I want find() to only return
documents where the last element in an array matches a certain value. Is
there some kind of operator for this, or am I out of luck? Thanks.
You received this message
Hi,
My collection is something like this,
{
"_id" : ObjectId("5077e898e4b05e76f3b6f392"),
"questions" : [
{
"questionID" : 1,
"section" : "general"
},
]
}
I wanted to update questions array based on the users visit, suppose if user visits
question#2 then one more element should be added