Scripted Patch using CURL

50 views
Skip to first unread message

Lee

unread,
Jun 19, 2013, 11:52:26 AM6/19/13
to rav...@googlegroups.com
Hi,

Trying to do the following in CURL

store.DatabaseCommands.UpdateByIndex("Raven/DocumentsByEntityName", new IndexQuery() { Query = "Tag: risimported", Cutoff = DateTime.Now.AddMinutes(10) }, new ScriptedPatchRequest() { Script = "this.ImportedOn = new Date(this.ImportedOn)" });

Got this so far...

CURL -X EVAL http://localhost:8080/databases/Tagging/bulk_docs/Raven/DocumentsByEntityName?query=Tag:risimported -d [{Script:"this.ImportedOn = new Date(this.ImportedOn);"}]

But im getting an error, any help?...

sByEntityName?query=Tag:risimported -d [{Script:"this.ImportedOn = new Date(thi
s.ImportedOn);"}]
{
  "Url": "/bulk_docs/Raven/DocumentsByEntityName?query=Tag:risimported",
  "Error": "Raven.Imports.Newtonsoft.Json.JsonReaderException: Error parsing boo
lean value. Path '[0].Script', line 1, position 9.\r\n   at Raven.Imports.Newton
soft.Json.JsonTextReader.ParseTrue()\r\n   at Raven.Imports.Newtonsoft.Json.Json
TextReader.ParseValue()\r\n   at Raven.Imports.Newtonsoft.Json.JsonTextReader.Re
adInternal()\r\n   at Raven.Imports.Newtonsoft.Json.JsonTextReader.Read()\r\n
at Raven.Json.Linq.RavenJObject.Load(JsonReader reader)\r\n   at Raven.Json.Linq
.RavenJArray.Load(JsonReader reader)\r\n   at Raven.Json.Linq.RavenJToken.ReadFr
om(JsonReader reader)\r\n   at Raven.Abstractions.Json.JsonToJsonConverter.ReadJ
son(JsonReader reader, Type objectType, Object existingValue, JsonSerializer ser
ializer)\r\n   at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInte
rnalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAddition
alContent)\r\n   at Raven.Imports.Newtonsoft.Json.JsonSerializer.DeserializeInte
rnal(JsonReader reader, Type objectType)\r\n   at Raven.Database.Extensions.Http
Extensions.ReadJsonObject[T](IHttpContext context)\r\n   at Raven.Database.Serve
r.Responders.DocumentBatch.Respond(IHttpContext context)\r\n   at Raven.Database
.Server.HttpServer.DispatchRequest(IHttpContext ctx)\r\n   at Raven.Database.Ser
ver.HttpServer.HandleActualRequest(IHttpContext ctx)"
}

Oren Eini (Ayende Rahien)

unread,
Jun 19, 2013, 2:48:21 PM6/19/13
to ravendb
Huh?
You are trying to force a value to be a js date object?
That won't really work, regardless. Can you show a fiddler saz file?


--
You received this message because you are subscribed to the Google Groups "ravendb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Lee

unread,
Jun 20, 2013, 4:52:28 AM6/20/13
to rav...@googlegroups.com
ah there is some reason for the madness...

It fixes the date issue (datetimeoffset to datetime? errors in the index) from version 427 to the latest build.  It resaves the datetime objects with the correct format, i was just hoping to do it all via curl rather than the silverlight front end or in code...

Lee
Reply all
Reply to author
Forward
0 new messages