MongoDB - Robo3t: Failed to do query, no good nodes, Field 'cursor' must be a nested object - mongodb

When viewing documents of a collection and trying to move between pages using "left" and "right" arrow buttons:
suddenly started to get the following error:
Failed to load documents.
Error:
Failed to do query, no good nodes in MyCluster-shard-0, last error: can't query replica set node mycluster-shard-xx-xx.xxx.xxx.net:27017 :: caused by :: Field 'cursor' must be a nested object in: { conversationId: 7, done: false, payload: BinData(0, 723D424753514D4F432F494C776E73765A7263356774622F42564B695A62746F45523832456A5244475473346E30616B4B597938686352413D3D2C733D6F52614C316438586F...), ok: 1 }
Any idea of why is this happening?
Using Robo3T 1.4 on Ubuntu/Windows 10 - same thing on both OS.

Related

MongoDB Atlas throws error with $in operator

I have developed an app with local version of community MongoDB (v4.4). Now I've connected to Mongo Atlas (it's running v 4.2).
I'm running a watch command to create a changestream.
While with my local setup everything works, with atlas I get an error
MongoError: Error validating $match value for change streams. err=ns field has bson.D value that is not string or valid MongoDb RegEx: Error parsing value [{$in [somestring1 somestring2 somestring3]}] to RegEx: Must specify $regex field
The query, resp. watch pipeline is
Database.watch([
{
"$match":{
"ns.coll":{
"$in":["somestring1","somestring2","somestring3"]
}
}
}
],
{fullDocument:"updateLookup"}
)
I've changed it to $or alternative:
Database.watch([
{
"$match":{
"$or":[
{"ns.coll":"somestring1"},
{"ns.coll":"somestring2"},
{"ns.coll":"somestring3"}
]
}
}
],
{fullDocument:"updateLookup"}
)
This works correctly.
The Database is a connection from nodejs driver. And the error is an immediate response from atlas server after calling the watch.
The error has also this properties:
ok: 0,
code: 8000,
codeName: 'AtlasError'
What's the problem? What can/should I do about it?
While the workaround works, I guess it is less performant.

MongoDB 4.0 JRException: The 'cursor' option is required, except for aggregate with the explain argument

I recently changed my MongoDB database version from 3.4 to 4.0 and I started getting this error:
Even though I added the cursor option: cursor :{} I get the error no result Found
{
runCommand: {
aggregate : 'Org',
pipeline : [
{
$project : {
Miss_Attr.categorie:1,
Miss_Attr.texte:1
}
},
{ $unwind : '$Miss_Attr'}
]
}}
Error:
net.sf.jasperreports.engine.JRException:
net.sf.jasperreports.engine.JRRuntimeException:
net.sf.jasperreports.engine.JRException: The 'cursor' option is
required, except for aggregate with the explain argument
at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:550)
at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$18(ReportController.java:525)
at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:443)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: net.sf.jasperreports.engine.JRRuntimeException:
net.sf.jasperreports.engine.JRException: The 'cursor' option is
required, except for aggregate with the explain argument
at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:150)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:152)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:542)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:453)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:428)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2585)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:813)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:264)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
at java.lang.Thread.run(Thread.java:748) Caused by: net.sf.jasperreports.engine.JRException: The 'cursor' option is
required, except for aggregate with the explain argument
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.runCommand(MongoDbQueryWrapper.java:207)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.processQuery(MongoDbQueryWrapper.java:115)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.(MongoDbQueryWrapper.java:93)
at com.jaspersoft.mongodb.query.MongoDbQueryExecuter.createDatasource(MongoDbQueryExecuter.java:104)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1257)
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:726)
at net.sf.jasperreports.components.list.FillDatasetRun.start(FillDatasetRun.java:166)
at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:102)
... 11 more
This article on JasperSoft forums fixes this:
https://community.jaspersoft.com/jasperreports-server/issues/10886
Outlined steps (on JasperSoft Server 7.2.0)
Download these two JAR files:
Mongo Java Driver
JS MongoDB driver
Remove the older variants of these files from {jasperserver_root}\apache-tomcat\webapps\jasperserver\WEB-INF\lib
Place files from step 1 into {jasperserver_root}\apache-tomcat\webapps\jasperserver\WEB-INF\lib
Reboot reporting server
For JasperSoft Studio, this is fixed in version 7.5.0. Also, it might be that this is fixed in JasperSoft Server 7.5.0, however, my current deployment is 7.2.0

MongoDB Error when querying a capped collection

I need some help interpreting/resolving this error:
OperationFailure: Executor error during find command :: caused by :: errmsg: "CollectionScan died due to position in capped collection being deleted. Last seen record id: RecordId(225404776)"
which occurs when I run this command:
mongodb_connection["databaseName"]["cappedCollectionName"].find(query)
The mongodb instance is a "single" instance, and we are querying a "capped" collection. The query is looking at recent data, which should be in the DB (and not written over via the cap).
Thanks!

sails js - error when clean the collections in start up

In my sails application I edit the config/models.js file as follows to clean the database when lifting the application.
migrate: 'drop',
connection: 'mongodb'
But when I try to run the application it displays the following error.
A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
MongoError: Index with name: _id_ already exists with different options
I am using sails version 0.10.5 ,any kind of help would be appreciated.
same here, when you have an error to the model the orm crashes, at least you have the error, sometimes with mysql you don't even have the error
the issue was, in some of my application's model files I have added following to attributes list.
attributes: {
_id: {
type: 'string',
unique: true
}
}
since I have added unique true to the attribute, it causes an error when I try to clean the collections on start up. more information about this issue can be found on Index already exists with different options error while using createIndex() in latest MongoDB java driver

mongodb sharded collection query failed: setShardVersion failed host

I have encountered a problem after adding a shard to mongodb cluster.
I did the following operations:
1. deploy a mongodb cluster with primary shard named 'shard0002'(10.204.8.155:27010) for all databases.
2. for some reason I removed it and add a new shard of different host (10.204.8.100:27010, was automaticlly named shard0002 too) after migrating finished.
3. then add another shard (the one removed in step 1), named 'shard0003'
4. executing query on a sharded collection.
5. the following errors appeared:
mongos> db.count.find()
error: {
"$err" : "setShardVersion failed host: 10.204.8.155:27010 { errmsg: \"exception: gotShardName different than what i had before before [shard0002] got [shard0003] \", code: 13298, ok: 0.0 }",
"code" : 10429
}
I tried to rename the shardname, but it's not allowed.
mongos> use config
mongos> db.shards.update({_id: "shard0003"}, {$set: {_id: "shard_11"}})
Mod on _id not allowed
I have also tried to remove it, draining stared but processing seems hung up.
what can I do ?
------------------------
lastupate (24/02/2014 00:29)
I found the answer on google. since mongod has it's own cache for mongod configuration, just restart the sharded mongod process, the problem will be fixed.