MongoDB Shema to support concurrent update on a document

We were working on a project with a 300 documents with currentValue field in a main collection, in order to track the history of each document of first collection. we created another collection named history with approximately 6.5 millions of documents. For each input of system we have to add around 30 history item and update currentValue field of main collection, so, We tried computational field design pattern for currentValue, which lead us to have writeConfilict in concurrent situations (at concurrency of around 1000 requests).

Then we tried to compute currentValue field with sum (amount field) and groupBy(mainId field) on history collection which takes too long (> 3s).

Main collection docs:

{     "_id" : ObjectId(...),     "stock" : [          {             "currentAmount" : -313430.0,             "lastPrice" : -10.0,             "storage" : ObjectId("..."),             "alarmCapacity" : 12         },          {             "currentAmount" : 30,             "lastPrice" : 0,             "storage" : ObjectId("..."),             "alarmCapacity" : 12         },         .        .        .     ],     "name" : "name",  }   

History collection docs:

{     "_id" : ObjectId("..."),     "mainId" : ObjectId("..."),     "amount" : 5, } 

If you have any other idea to handle this situation(application or db level), I would be thankful.

UPDATE 1

The update query if I use computed pattern would be:

mainCollection.findOneAndUpdate(             {                 $  and: [                     { _id: id },                     { "stock.storage": fromId },                     { "stock.deletedAt": null }                 ],             },             {                 $  inc: {                     "stock.$  .currentAmount": -1 * amount,                 }             },             {                 session             }         ) 

And Aggregation pipeline if I want to calculate currentAmount everytime:

mainCollection.aggregate([             {                 $  match: {                      branch: new ObjectId("...")                 }             },             {                 $  group: {                     _id: "$  ingredient",                     currentAmount: {                         $  sum: "$  amount"                     }                 }             }]) 

May I link to SRD in a document under OGL?

I am writing a house rules document for a Pathfinder game. Not publishing it would be a pity, and not using OGL to publish it likewise, since publishing the house rules under OGL allows others to use the same content.

Can I add links to various SRDs in the document?

For example, if I link to the website of Paizo, the link might be http://paizo.com/pathfinderRPG/prd/coreRulebook/gettingStarted.html. The link contains the word paizo, which is designated as product identity in Paizo’s SRD. I suspect that this is also the case with SRDs maintained by third parties.

Quoting or not quoting text from other OGL content

Currently I do not quote any text from any other OGL publication (aside from the license text). Later, I may quote such material, which would make it necessary for me to attribute the text to its proper source. Suppose the source is a Pathfinder product (and the quoted text is open content). Does this change the answer to the first question?

Content of the document

The document has content such as: “Player may choose zero or one traits for the character, or two traits and one drawback.”

It also contains more substantial content, such as a rewritten version of the content of this blog post: https://ropeblogi.wordpress.com/2016/05/25/religious-tenets-for-clerics/

Is “document loaded” different on admin side than public side?

I’m writing a plugin to support Google Graphs. It’s working fine on the public side, but is intermittently rendering weirdly on the admin side, and also intermittently throwing errors that make me think the JS is running too soon. (for example, TypeError: null is not an object (evaluating 'document.getElementById(colControlId).appendChild'), but when I go inspect the page, that element is absolutely there.

The function that drives everything is registered to the Google library as a callback:

// Load the Visualization API and the corechart package. google.charts.load('current', {'packages':['corechart', 'controls']});  // Set a callback to run when the Google Visualization API is loaded. google.charts.setOnLoadCallback(initializeData);  // Query a CSV for the data function initializeData() {         let graphs = document.getElementsByClassName("cwraggbp_chart"); 

The Google docs say, "When the packages [loaded above by google.charts.load] have finished loading, this callback function will be called with no arguments. The loader will also wait for the document to finish loading before calling the callback."

But, I can’t see how I can be getting this error intermittently if the DOM is fully loaded, and I don’t know what "document loaded" means. So, since this works flawlessly on the public side, but not in admin, I’m wondering if … something is different.

I’m loading the scripts thusly:

    public function enqueue_scripts() {              wp_enqueue_script( $  this->plugin_name . '-public',                 plugin_dir_url( __FILE__ )                     . 'js/cwra-google-graph-block-public.js', // this is where the JS above is                 array( $  this->plugin_name . 'googlecharts', 'jquery' ),                 $  this->date_version(                     'js/cwra-google-graph-block-public.js'), false );             wp_localize_script( $  this->plugin_name . '-public',                 'cwraggbp',                 array(                     'contentdir' => wp_upload_dir()['baseurl']                         . '/cwraggb'                 ));              wp_enqueue_script( $  this->plugin_name . 'googlecharts',                 'https://www.gstatic.com/charts/loader.js',                 array(), $  this->version, false );      } 

Long after the demise of Google Authorship, is it now both valid and viable for a document to include multiple links?

When Google Authorship was very much still a thing several years ago, the conclusion was that it was better not to include more than one <link rel="author"> on any given page.

See:

  • 2012 – How to implement rel="author" on a page with multiple authors?
  • 2013 – Is Google OK with multiple rel="author" links?

Google Authorship is now a distant memory (Mountain View stopped using it several centuries ago in 2016) but I’m concerned that there may still be something invalid or nonsensical about including more than one <link rel="author"> in the <head> of a given document.

My use case involves referencing both an About Page and humans.txt:

<link rel="author" href="https://example.com/about-us/" /> <link rel="author" href="https://example.com/humans.txt" type="text/plain" /> 

Is there anything – I can’t find explicit confirmation – from the WHAT-WG to confirm that this is valid usage?

Or is there a viable alternative to using more than one <link rel="author"> element?

Is there a way to learn what was written in a burned document?

I’m playing pathfinder and I just recovered the ashes of burned papers. The Dm told me make whole wouldn’t work because a big part of the paper went off in smoke and as such there isn’t all the parts. Is there any divination spell that could help me recover some information ? I have access to a good amount of gold and a fairly large city so I could pay a spellcaster to cast it if it is too high-level. I have neither access to the vilain and the document is probably a little too much damaged to use linguistics on

Can a structured (text) document be effectively encrypted

My situation:

I want to encrypt an HTML document. My question is, if the following is known, is that going to weaken encryption?

  • It is a text-based document
  • It starts with <DOCTYPE HTML> or a few variants of
  • This is followed by an <HTML> tag, followed by a <HEAD> tag, which contains a number of ‘

Would this knowledge help a hacker to decrypt without the decrypt key? Would such knowledge make my documents effectively un-encryptable?

My apologies if this is a very simple question. I am a neophyte.

Which Algorithm should PFX file use to sign PDF document?

I exported localhost certificate in .PFX format with private key. I have to use this PFX file to sign PDF document. C# program was used to sign document and below error encountered when hitting this code-

C# code –

 Pkcs12Store pk12;  pk12 = new Pkcs12Store(new FileStream(this.Path, FileMode.Open, FileAccess.Read), this.password.ToCharArray()); 

error –

 Unable to cast object of type 'Org.BouncyCastle.Asn1.DerSequence' to type 'Org.BouncyCastle.Asn1.DerInteger' 

is error associated with mismatch in algorithm? Below are steps used to export PFX file. enter image description here enter image description here enter image description here enter image description here

I am using itextSharp library to sign PDF document. Is there any error in PFX file OR localhost file should not be used? how can I validate PFX file whether it is correct?

Thanks.