'Create an auxiliar MongoCollection to hold Documentes
Im trying to find a way to apply two different finds on a collection, so that i can find documents on the most recent 50, that have a Date greater than a certain one. My initicial solution would be to create an auxiliary MongoCollectio just to hold the documents so that i could apply the second find query. Any way to do this, or to do the query in one line?
MongoCollection<Document> cloudt1aux = (MongoCollection<Document>) cloudcollectiont1.find().sort(new BasicDBObject("_id", -1)).limit(50);
localcollectiont1.insertMany((List<? extends Document>) cloudt1aux.find(gt("Data",datat1)).sort(new BasicDBObject("_id", -1)));
datat1 = (String) cloudt1aux.find().sort(new BasicDBObject("_id", -1)).first().get("Data");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
