I am using following code (MongoDB C# driver) to projects fields ,
where queryDocument = '{{ "FullName" : /myname/i }}'
BsonDocument projectionDefination = Builders.Projection.ToBsonDocument();
projectionDefination.Add(new BsonElement("FullName", "myname"));
collection.Find(queryDocument).Project(projectionDefination);
getting following error:
{"Command failed."}
{{ "_t" : "OKMongoResponse", "ok" : 0, "code" : 9, "errmsg" : "Syntax error, incorrect syntax near '9'.", "$err" : "Syntax error, incorrect syntax near '9'." }}
Can anyone update on this?
I also tried above with RoboMongo
Command: db.getCollection('Employee').find({ "FullName": /User/i}).projection({ "FullName" : "$FullName" })
Received following error:
Error: error: {
"_t" : "OKMongoResponse",
"ok" : 0,
"code" : 9,
"errmsg" : "Syntax error, incorrect syntax near '15'.",
"$err" : "Syntax error, incorrect syntax near '15'."
}
According to your description, I checked this issue and I could encounter the same issue:
As mongoDB document states about Projection in db.collection.find():
The projection parameter determines which fields are returned in the matching documents. The projection parameter takes a document of the following form:
{ field1: <value>, field2: <value> ... }
The <value> can be any of the following:
1 or true to include the field in the return documents.
0 or false to exclude the field.
Related
I am trying to fetch the SHA_256 value from manifest.json file but unable to get using aql.
Below is the cmd I am using:
ubuntu#test:~$ **curl -sS -u sumkumar:$pw -XPOST -k -H "Content-type: text/plain" https://<URL>/artifactory/api/search/aql -d 'items.find({"repo":"xyz"},{"path":"a/b/c"}).include("*")'**
{
"results" : [ {
"repo" : "xyz",
"path" : "a/b/c",
"name" : "manifest.json",
"type" : "file",
"size" : 1579,
"created" : "2018-03-13T11:58:33.771Z",
"created_by" : "uex-sp-cd",
"modified" : "2018-03-15T14:17:38.299Z",
"modified_by" : "uex-sp-cd",
"updated" : "2018-03-15T14:17:38.299Z",
"depth" : 4,
"actual_md5" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"actual_sha1" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"original_md5" : "NO_ORIG",
"original_sha1" : "NO_ORIG",
"virtual_repos" : [ ]
},{
However, if you look the original manifest.json file from UI.It contains SHA256 value.
enter image description here
According to the AQL documentation, the item entity has the sha256 field. But it mentions the following note:
SHA-256 is supported from Artifactory version 5.5
You can only do an AQL search on an Artifact that has been deployed to Artifactory version 5.5 or above, or if you have migrated your database as described in SHA-256 Support after upgrading Artifactory to version 5.5 and above.
Please verify your Artifactory fits the requirements above.
In addition, assuming this is a Docker manifest.json, it specifically should also have the SHA256 in a property named docker.manifest.digest (and maybe also a property named sha256). To get the property values you can add "property.*" to the include(..) part of the query.
For example:
items.find({"repo":"xyz","path":"a/b/c","name":"manifest.json"})
.include("repo","path","name","sha256","property.*")
Will return something like:
{
"results" : [ {
"repo" : "xyz",
"path" : "a/b/c",
"name" : "manifest.json",
"sha256" : "34cb6f8e1e1aca...",
"properties" : [ {
"key" : "docker.manifest.digest",
"value" : "sha256:34cb6f8e1e1aca..."
},{
"key" : "sha256",
"value" : "34cb6f8e1e1aca..."
}
...
I have kinesis stream from DynamoDB. And I am processing it through aws KCL sdk v1.14.0. I see below occasional errors in the logs. I also observe that startingHashKey is always 1 and endingHashKey is 0 for all shards in the dynamodb lease table. Any clue why is this happening?
Incomplete hash range found between {
"leaseKey" : "shardId-00000001601992582645-697387df",
"leaseOwner" : "eu01-stg01-vendor-service-74b4cd66b6-6hcfb:29dafc2f-c87f-4c70-b210-d38db7ebfc87",
"leaseCounter" : 4080,
"concurrencyToken" : null,
"lastCounterIncrementNanos" : null,
"checkpoint" : {
"sequenceNumber" : "47515300000000010794885359",
"subSequenceNumber" : 0,
"shardEnd" : false
},
"pendingCheckpoint" : null,
"ownerSwitchesSinceCheckpoint" : 0,
"parentShardIds" : [ ],
"childShardIds" : [ ],
"hashKeyRange" : {
"startingHashKey" : 0,
"endingHashKey" : 1
}
} and {
"leaseKey" : "shardId-00000001602005637902-6358a08a",
"leaseOwner" : "eu01-stg01-vendor-service-74b4cd66b6-6hcfb:29dafc2f-c87f-4c70-b210-d38db7ebfc87",
"leaseCounter" : 397,
"concurrencyToken" : null,
"lastCounterIncrementNanos" : null,
"checkpoint" : {
"sequenceNumber" : "TRIM_HORIZON",
"subSequenceNumber" : 0,
"shardEnd" : false
},
"pendingCheckpoint" : null,
"ownerSwitchesSinceCheckpoint" : 0,
"parentShardIds" : [ "shardId-00000001601992582736-2c3fc0ff" ],
"childShardIds" : [ ],
"hashKeyRange" : {
"startingHashKey" : 0,
"endingHashKey" : 1
}
}
I also get this error, but the stream seems to work properly. (I am using it to monitor the data change).
Then I dig the source code of this error log, find the part code is added on Jun 22, 2020,
This is the source code: https://github.com/awslabs/amazon-kinesis-client/blob/6fbfc21ad7d6a2722491806a411d168304167f7f/src/main/java/com/amazonaws/services/kinesis/clientlibrary/lib/worker/PeriodicShardSyncManager.java#L298
This is the blame: https://github.com/awslabs/amazon-kinesis-client/blame/6fbfc21ad7d6a2722491806a411d168304167f7f/src/main/java/com/amazonaws/services/kinesis/clientlibrary/lib/worker/PeriodicShardSyncManager.java#L298
This is the commit: https://github.com/awslabs/amazon-kinesis-client/commit/3a88a60a4ee7bb8f969b36cb79e7665a7395b6ec
it is only in the latest version: 1.14.0
So I go back one version to use 1.13.3 then no this error.
I have submitted an issue on the GitHub to see what the reason for the error. https://github.com/awslabs/amazon-kinesis-client/issues/758
Objective
Refresh a partition using a query (override). Using these as a guide:
https://www.sqlbi.com/articles/using-process-add-in-tabular-models/
https://gist.github.com/dgosbell/a7bc9fe9ff5a99fdb4df5819b8760217#file-refresh-with-override-example-txt
Apparently the MS example is not correct: https://learn.microsoft.com/en-us/bi-reference/tmsl/refresh-command-tmsl#examples
TMSL Script
{
"refresh" : {
"type" : "add",
"objects" : [{
"database" : "dbname",
"table" : "tblname"
}
],
"overrides" : [{
"partitions" : [
{
"originalObject" : {
"database" : "dbname",
"table" : "tblname",
"partition" : "partname"
},
"source" : {
"query" :
"SELECT * FROM source.view WHERE date_field = '2014-12-06'"
}
}
]
}
]
}
}
Error Message
The JSON DDL request failed with the following error: Failed to execute XMLA. Error returned: 'The Process command for partition 'partname' in table 'tblname' cannot be executed because the pipeline rowset is missing.
'..
Technical Details:
RootActivityId: 89a6f9ac-e5d4-4eaa-b049-455190039b4b
Date (UTC): 6/28/2019 3:20:36 PM
0: PFError::SetLastError() line 2158 + 0x0 (sql\picasso\engine\src\pf\eh\pferror.cpp)
1: PFSetLastError() line 2906 + 0x0 (sql\picasso\engine\src\pf\eh\pferror.cpp)
2: ConvertExceptionsToPFResult<<lambda_764f81a97ea803a6bb1663c7971ce151> >() line 424 + 0x34 (sql\picasso\engine\src\pf\kernel\shared\pfshmacros.inl)
3: PFSetLastErrorExTag() line 3461 + 0x2e (sql\picasso\engine\src\pf\eh\pferror.cpp)
4: 0x00007FFAB599CC7E (symbolic name unavailable)
Other Info
Executed on SSMS directly and in Powershell (via Runbook) with same error message.
Question
What does this error message mean exactly? (It is very hard to find
helpful documentation.) Or, is there an alternative solution to refreshing
a partition using a query override?
You can only use either a Query or M partition sources
If you are using an M partition source the syntax is:
"source":{
"type":"m",
"expression":"…"
}
And if you are using a Query partition source the syntax is:
"source":{
"type":"query",
"query":"…",
"dataSource":"…"
}
Here is what you get in mongo shell :
db.col.find(ObjectId("5571849db1969e0a6eb32731")).pretty()
{
"_id" : ObjectId("5571849db1969e0a6eb32731"),
"name" : "Some name",
"logo" : "Some logo",
"users" : [
ObjectId("5571830031c7fc341bc2e105"),
ObjectId("5571830031c7fc341bc2e107")
],
"admins" : [ ],
"__v" : 0,
"steps" : 5782
}
Here is what I get in rmongo :
myResult <- mongo.find(Connexion, "db.col", query='ObjectId("5571849db1969e0a6eb32731")')
#Error in mongo.bson.from.JSON(arg) :
# Not a valid JSON content: ObjectId("5571849db1969e0a6eb32731")
So, how to do it right ?
Just in case : I had a look at this already. But mongolite doesn't support authentication (which is therefore a no-go) and I don't understand what to do with the second answer. If I try
result <- mongo.find(Connexion, "db.col", query=mongo.oid.from.string("5571849db1969e0a6eb32731"))
I get
# Error in mongo.bson.from.argument(query) : Can't convert to bson: argument should be one of 'list', 'mongo.bson' or 'character'(valid JSON)
This should work:
result <- mongo.find(Connexion, "db.col", query=list('_id' = mongo.oid.from.string("5571849db1969e0a6eb32731")))
I have created Json response file in Company Home > Data Dictionary >
Web Scripts > org > alfresco > sample with the Name:
folder.get.json.ftl for one of the Alfresco Web
Script(http:// localhost:8080/alfresco/service/sample/folder/Company%20Home)according
to the guidelines mentioned in
http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Fws-json-add.html.
After successful addition of the webscript , i have refresh the
Webscripts.
Now when im tring to call this websrcipt using the URL
http:// localhost:8080/alfresco/service/sample/folder/Company%20Home?format=json
i am getting Internal Error(500).
Please help me out regarding this.
Thanks in Advance!!!!
Below is the stack trace
{
"status" :
{
"code" : 500,
"name" : "Internal Error",
"description" : "An error inside the HTTP server which prevented it from fulfilling the request."
},
"message" : "01270141 Wrapped Exception (with status template): 01270216 Error during processing of the template 'Expression verbose is undefined on line 12, column 14 in org\/alfresco\/sample\/folder.get.json.ftl.'. Please contact your system administrator.",
"exception" : "org.springframework.extensions.webscripts.WebScriptException - 01270141 Wrapped Exception (with status template): 01270216 Error during processing of the template 'Expression verbose is undefined on line 12, column 14 in org\/alfresco\/sample\/folder.get.json.ftl.'. Please contact your system administrator.",
"callstack" :
[
"" ,"freemarker.core.InvalidReferenceException: Expression verbose is undefined on line 12, column 14 in org\/alfresco\/sample\/folder.get.json.ftl."
,"freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)"
,"freemarker.core.Expression.isTrue(Expression.java:145)"
,"freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)"
,"freemarker.core.Environment.visit(Environment.java:221)"
,"freemarker.core.MixedContent.accept(MixedContent.java:92)"
,"freemarker.core.Environment.visit(Environment.java:221)"
,"freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)"
,"freemarker.core.Environment.visit(Environment.java:428)"
,"freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)"
,"freemarker.core.Environment.visit(Environment.java:221)"
,"freemarker.core.MixedContent.accept(MixedContent.java:92)"
,"freemarker.core.Environment.visit(Environment.java:221)"
,"freemarker.core.Environment.process(Environment.java:199)"
,"org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:202)"
,"org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:714)"
,"org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)"
,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)"
,"org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:400)"
,"org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)"
,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:453)"
,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:491)"
,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)"
,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:352)"
,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)"
,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)"
,"javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"
,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)"
,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
,"org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)"
,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)"
,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)"
,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)"
,"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)"
,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)"
,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)"
,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)"
,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)"
,"org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)"
,"org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)"
,"org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)"
,"java.lang.Thread.run(Thread.java:619)"
,"org.alfresco.service.cmr.repository.TemplateException: 01270216 Error during processing of the template 'Expression verbose is undefined on line 12, column 14 in org\/alfresco\/sample\/folder.get.json.ftl.'. Please contact your system administrator."
,"org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:206)"
,"org.springframework.extensions.webscripts.WebScriptException: 01270141 Wrapped Exception (with status template): 01270216 Error during processing of the template 'Expression verbose is undefined on line 12, column 14 in org\/alfresco\/sample\/folder.get.json.ftl.'. Please contact your system administrator."
,"org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:884)"
],
"server" : "Community v4.0.0 (a r30055) schema 5,016",
"time" : "Feb 27, 2012 9:53:23 AM"
}
The key line is:
freemarker.core.InvalidReferenceException: Expression verbose is undefined on line 12, column 14 in org/alfresco/sample/folder.get.json.ftl.
Your template, on line 12, character 14, you've referenced a variable "verbose" which doesn't exist. You should either set that variable in the model, or check if it's defined or not before using it.