Re: OpLogInfo in java Driver 3.2 vs 2.1

From: Ross Lawley <ross@xxxxxxxxxxx>
To: mongodb-user@xxxxxxxxxxxxxxxx
Date: Mon, 18 Apr 2016 08:58:31 +0100
Why ads?
Hi,

It looks like a simple issue, you aren't querying the same collection in 3.2

localDB.getCollection("*system.**namespaces*") !=
localDB.getCollection("*oplog.rs
<http://oplog.rs>*")

If you update the 3.2 code to:

import static com.mongodb.client.model.Filters.eq;

MongoCollection<org.bson.Document> collection = localDB.getCollection(
"system.namespaces");
Document object = collection.find(eq("name", "local.oplog.rs")).first();
LogFileSizeMB = object.get("options", Document.class).getDouble("size") /
(1024 * 1024);

It should be the same.

Ross


On Mon, Apr 11, 2016 at 2:29 PM, majeed said <majeed.said@xxxxxxxxx> wrote:

Hi,

 i have the following concern :
 we had an application that used java driver 2.1 with the following code :

BasicDBObject object = (BasicDBObject)
localDB.getCollection("system.namespaces").findOne(new
BasicDBObject("name", "local.oplog.rs"));

LogFileSizeMB = ((BasicDBObject) object.get("options")).getDouble("size")
/ (1024 * 1024);

now after we moved to java driver 3.2 :

MongoCollection<org.bson.Document> collection = localDB.getCollection("
oplog.rs <http://local.oplog.rs/>");
MongoCursor<Document> cursor = collection.find().iterator();

the cursor always returning empty and we get the object as NULL.

can u please advise how can we change the implementation to get real data
for setting OpLogInfo (log file size) ?

Regards,
Majeed Said

--
You received this message because you are subscribed to the Google Groups
"mongodb-user"
group.

For other MongoDB technical support options, see:
https://docs.mongodb.org/manual/support/
---
You received this message because you are subscribed to the Google Groups
"mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mongodb-user/0962cdb1-7160-4759-9cf2-83a7bcc97876%40googlegroups.com
<https://groups.google.com/d/msgid/mongodb-user/0962cdb1-7160-4759-9cf2-83a7bcc97876%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.




-- 


*{* name     : "Ross Lawley",
  title    : "Senior Software Engineer",
  location : "London, UK",
  twitter  : ["@RossC0 <http://twitter.com/rossc0>", "@MongoDB
<https://twitter.com/mongodb>"],
  facebook :"MongoDB
<https://www.google.com/url?q=https%3A%2F%2Fwww.facebook.com%2Fmongodb&sa=D&sntz=1&usg=AFQjCNGPMcaFBzmWsh-MpaWeTH6vMQoDIg>
"*}*

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAOjLY%2BHJq6JZBv34dgf%2Bug5yusZMzCvzn7fKQQ6Moom4JsedyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?