public MlResult IngestDocument <T>(T document, DocumentProperties properties, string database = null) { if (string.IsNullOrEmpty(properties.DocumentUri)) { throw new ArgumentException("Properties.DocumentUri can not be empty"); } StartTimer(); var documentJson = JsonConvert.SerializeObject(document); var result = MlRestApi.QueryMarkLogic(_connection, JavascriptQueryCreator.IngestDocument(documentJson, properties), database); StopTimer(); return(result); }
public static string IngestDocument(string documentJson, DocumentProperties properties) { return(string.Format("declareUpdate();xdmp.documentInsert('{0}', {1}, {2}, {3});", properties.DocumentUri, documentJson, PermissionBuilder.CreatePermissionsTable(properties.Permissions), CollectionBuilder.CreateCollectionsTable(properties.Collections))); }