The mordodb mapreduce function does not provide bandwidth, is their solution for this?

The Mongodb mapreduce function does not provide any way to skip a record from a database, such as a search function. It has the functionality of query parameters, sorting and restrictions. But I want to skip some entries from the database, and I do not get any access to it. please provide solutions.

Thanks in advance.

+3
source share
2 answers

Ideally, a well-structured downscaling query will allow you to skip specific documents in your collection.

, , map(). - . 20 , ObjectID (, , ):

db.collection_name.mapReduce(map, reduce, {out: example_output, sort: {id:-1}, scope: "var counter=0")}; 

:

function(){
    counter ++;
    if (counter > 20){
        emit(key, value);
    }
}
+12

, , , , MongoDB 2.6 mapReduce() query

query:

. , .

, :

{
     _id: ObjectId("50a8240b927d5d8b5891743c"),
     cust_id: "abc123",
     ord_date: new Date("Oct 04, 2012"),
     status: 'A',
     price: 25,
     items: [ { sku: "mmm", qty: 5, price: 2.5 },
              { sku: "nnn", qty: 5, price: 2.5 } ]
}

mapFunction2, reduceFunction2 finalizeFunction2.

db.orders.mapReduce( mapFunction2,
                 reduceFunction2,
                 {
                   out: { merge: "map_reduce_example" },
                   query: { ord_date:
                              { $gt: new Date('01/01/2012') }
                          },
                   finalize: finalizeFunction2
                 }
               )

ord_date , new Date(01/01/2012). map_reduce_example. map_reduce_example , .

0

All Articles