Questions tagged [mongodb-3.6.4]
5 questions
                    
                    1
                    
            vote
                
                1 answer
            
        Find keys with value in another collection
We have a request collection ,with example documents as below:
{
    "_id" : ObjectId("xxxxxx"),
    "requestId" : "REQ4",
    "scrip" : "5647"
}
{
    "_id" : ObjectId("xxxxxx"),
    "requestId" : "REQ4",
    "scrip" : "5648"
}
{
    "_id" :…
        
        IUnknown
        
- 9,301
 - 15
 - 50
 - 76
 
                    0
                    
            votes
                
                1 answer
            
        Aggregate pipeline involving $in
We have a shop collection:
    {
        "_id" : ObjectId("xxxxxx"),
        "shop" : "Q4",
        "batch" : "5647",
    }
    {
        "_id" : ObjectId("xxxxxx"),
        "shop" : "Q4",
        "batch" : "2314",
    }
First step of aggregation…
        
        IUnknown
        
- 9,301
 - 15
 - 50
 - 76
 
                    0
                    
            votes
                
                1 answer
            
        push on condition into array
We need to push/addtoset  only if the key in the document ne []
How do we achieve this
{
    "_id" : ObjectId("xxxxxx"),
    "shop" : "REQ4",
    "bolt" : "5647",
    "nut" : "1111",
}
{
    "_id" : ObjectId("xxxxxx"),
    "shop" : "REQ4",
   …
        
        IUnknown
        
- 9,301
 - 15
 - 50
 - 76
 
                    0
                    
            votes
                
                0 answers
            
        How to execute javascript function in 3.6.4 vs 2.4 Mongo server [system.js]
Currently in 2.4 MongoDB. If we create functions in MongoDB Server it can be tested well in the below way but facing error with 3.6.4
MONGO 2.4
$mongo emgda
>db.system.js.save({
...    "_id" : "getX",
...    "value" : "function(obj) { return 'Hey I…
        
        Ankur Soni
        
- 5,725
 - 5
 - 50
 - 81
 
                    -1
                    
            votes
                
                1 answer
            
        Filter keys not in collection
How do we find keys which do not exist in collection.
Given an input list of keys ['3321', '2121', '5647'] , i want to return those that do not exist in the collection :
{ "_id" : { "$oid" : "5e2993b61886a22f400ea319" }, "scrip" : "5647" }
{ "_id" :…
        
        IUnknown
        
- 9,301
 - 15
 - 50
 - 76