[SERVER-9412] is there difference connect with mongos and single instance? Created: 20/Apr/13  Updated: 24/Apr/13  Resolved: 24/Apr/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: auto Assignee: Stennie Steneker (Inactive)
Resolution: Won't Fix Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: http://docs.mongodb.org/manual/reference/mongos/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1478.0 Safari/537.36
Referrer: https://www.google.com/
Screen Resolution: 1280 x 800
repo: docs
source: reference/mongos


Participants:

 Description   

I use mongo dervier's clojure wrapper to connect to mongos,

(defn get-conn []
(let [conn (make-connection (:database db-config)
:host (:host db-config)
:port (:port db-config)
)]
(auth conn)
conn))

try to connect to mongos, but when query something:

(with-mongo conn
(apply fetch (concat '(:collection) args))))

always has exception:

java.lang.NullPointerException

at com.mongodb.DBCursor._check(DBCursor.java:365)
at com.mongodb.DBCursor._hasNext(DBCursor.java:459)
at com.mongodb.DBCursor.hasNext(DBCursor.java:484)
at clojure.lang.IteratorSeq.create(IteratorSeq.java:27)
at clojure.lang.RT.seqFrom(RT.java:495)
at clojure.lang.RT.seq(RT.java:486)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$map$fn__4215.invoke(core.clj:2479)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)

But if I use query like fetch-one, count, it works,
this code works for other single instance mongo.
what should I do?

Thanks!



 Comments   
Comment by Stennie Steneker (Inactive) [ 24/Apr/13 ]

The SERVER project is for reporting bugs or feature suggestions for the MongoDB server.

For MongoDB-related support discussion you should post on the mongodb-users group (http://groups.google.com/group/mongodb-user) or Stack Overflow. If your question is specific to a Clojure driver, there is probably a more focused discussion list for support depending on which driver you are using.

As far as connecting via mongod or mongos goes, they are using the same MongoDB Wire Protocol and your queries should work with either unless there is a driver bug.

Generated at Thu Feb 08 03:20:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.