top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Aggregate two arrays where both elements not null in MongoDB?

0 votes
305 views
Aggregate two arrays where both elements not null in MongoDB?
posted Nov 22, 2017 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote

I am storing color values as an array of 3 floats and want to query for distinct colors. Is there a way to make .distinct look for distinct arrays rather than values within the arrays?

+2 votes

Is there a way to compare two fields from different MongoDB Collections?

I have a 2 collections:
collection_1: { "english" : { "orth" : "africa", "pron" : "frik" }, "francais" : { "orth" : "afrique" } }
collection_2: { "form" : { "orth" : "afrique", "pron" : "afik" } "sense" : { "cit" : { "quote" : "africa" } }}

I would like to find all where "collection_1.english.orth" == "collection_2.form.orth" and copy/add "form.pron" from collection_2 into collection_1 under "francais.pron".

0 votes

Which of these two pymongo calls is the most optimized

A) count = db.find(nosql, {_id:True}).count()
B) count = db.find(nosql).count()

...