db.printCollectionStats() error - mongodb

I am getting the following error when I run:
db.printCollectionStats()
error: {
"$err" : "stale config on lazy receive :: caused by :: $err: \"[myzips.zips] shard version not ok in Client::Context: this shard contains versioned chunks for myzips.zips, but no version set in request ( ns : myzips.zip...\" ( ns : myzips.zips, received : 0|0||000000000000000000000000, wanted : 1|1||50fdd55b14faa2aa46422a7a, recv )",
"code" : 9996
} at src/mongo/shell/query.js:128
what does this mean?

Related

Laravel mongoDB groupBy - ERROR: Unrecognized expression '$last'

My below code is producing an error. If the groupBy is removed it works fine. But I only need to get distinct values for common_id. How can i solve this issue?
MasterAffiliateProductMappingMongo::select('_id', 'our_product_id')
->where('top_deal', '=', 'true')
->orderBy('srp', 'asc')
->groupBy('common_id')
->get();
Error: [MongoDB\Driver\Exception\RuntimeException] Unrecognized
expression '$last'
MongoDocument Example:
{
"_id" : ObjectId("5911af8209ed4456d069b1d1"),
"product_id" : "MOBDRYWXFKNPZVG6",
"our_product_id" : "5948e0dca6bc725adb35af2e",
"mrp" : 0.0,
"srp" : 500.0,
"ID" : "5911af8209ed4456d069b1d1",
"common_id" : ObjectId("5911af8209ed4456d069b1d1"),
"top_deal" : "true"
}
Error Log:
[2017-06-28 12:19:46] lumen.ERROR: exception
'MongoDB\Driver\Exception\RuntimeException' with message 'Unrecognized
expression '$last'' in
/var/www/html/PaymetryService4/vendor/mongodb/mongodb/src/Operation/Aggregate.php:219
Refer to this link https://github.com/jenssegers/laravel-mongodb/issues/1185#issuecomment-321267144 it works. We should remove '_id' from the select field.

Issue with mongodb document limit

I am using mongodb 3.0.2 and when I run "top" command :
> db.runCommand( { top: 1 } )
I got the following error message:
2015-06-01T16:36:52.886+0900 E QUERY Error: error: {
"$err" : "BSONObj size: 46060490 (0x2BED3CA) is invalid. Size must be between 0 and 16793600(16MB)",
"code" : 10334
}
at Error ()
at DBQuery.next (src/mongo/shell/query.js:259:15)
at DBCollection.findOne (src/mongo/shell/collection.js:189:22)
at DB.runCommand (src/mongo/shell/db.js:58:41)
at (shell):1:4 at src/mongo/shell/query.js:259
It means that I can't monitor any longer, doesn't it? Can you guys show me the way out, please.
Some additional info:
DB size: 143.996GB - with wiredtiger enable.
Replication set enable.
No profiling.

Mongo.getDatabaseNames() occasionally throws CommandFailureException

We have been having some problems where our mongo connection fails to allow us to get the database names from the DB.
We call the method:
com.mongodb.Mongo.getDatabaseNames()
And 1 out of 100 times, it throws the following exception:
Caused by: com.mongodb.CommandFailureException: { "serverUsed" : "localhost:27017" ,
"errmsg" : "exception: can't open database in a read lock. if db was just closed, consider retrying the query. might otherwise indicate an internal error" , "code" : 15927 , "ok" : 0.0}
at com.mongodb.CommandResult.getException(CommandResult.java:76)
at com.mongodb.CommandResult.throwOnError(CommandResult.java:131)
at com.mongodb.Mongo.getDatabaseNames(Mongo.java:397)
Looking at the mongo code, the database is the internal admin database
public List<String> getDatabaseNames(){
BasicDBObject cmd = new BasicDBObject();
cmd.put("listDatabases", 1);
>>CommandResult res = getDB(ADMIN_DATABASE_NAME).command(cmd, getOptions());
res.throwOnError();
This database is not being deleted, but there are several other databases that could be deleted around this time.
Has anyone else had this problem?

mongodb reconfigure shard ports

I have restarted 2 shards on non standard ports, by chaning their .conf files. Now when I connect via mongo and issue a listshards I get:
mongos> db.runCommand( { listshards : 1 } );
Tue Oct 23 17:36:21 uncaught exception: error {
"$err" : "error creating initial database config information :: caused by :: socket exception [CONNECT_ERROR] for vserver-dev-2:37017",
"code" : 11002
}
(37017 is the old port).
How can I update the shard ports on the router (mongos) ?
Manual updating the ports on the mongo config server:
mongo
use config
configsvr> db.shards.update({_id: "shard0000"} , {$set: {"host" : "vserver-dev-2:37018"}})
configsvr> db.shards.find()
{ "_id" : "shard0000", "host" : "vserver-dev-2:37018" }

MongoDB Access Error

Getting error something of this sort when accessing MongoDB. Any clue?
QueryFailure flag was unauthorized db:monza lock type:-1 client:10.173.78.216 (response was { "$err" : "unauthorized db:monza lock type:-1 client:10.173.78.216", "code" : 10057 }).