Inserting many documents in collection, but only unique elements, based on specific field. MongoDB

I cannot seem to find an answer on this anywhere. I need the following:

Given an array of objects with the structure:

{    link: 'some-link',    rating: 25,    otherFields: '..',    ... }  I want to insert them into my collection. So I would just do insertMany... But I only want to insert those elements of the array that are unique, meaning that I do not want to insert objects with the field "link" being something that is already in my collection.  Meaning if my collection has the following documents:  {   _id: 'aldnsajsndasd',   link: 'bob',   rating: 34, } {    _id: 'annn',    link: 'ann',    rating: 45 } 

And I do the “update/insert” with the following array:

[{   link: 'joe',    rating: 10 },{   link: 'ann',   rating: 45 }, {   link: 'bob',   rating: 34 }, {   link: 'frank',   rating: 100 }] 

Only documents:

{   link: 'frank',   rating: 100 } {    link: 'joe',   rating: 10 } 

Would be inserted in my collection

R-Precision of documents with same relevance degree

Let’s assume I have a collection of 10 documents,so |D| = 10 and a collection of relevant documents R , where |R| = 3 & R = {d1,d3,d8}. Then I make a query,q, to a random retrieval system and it returns this. Ans(S1,q) = < d1,d3,{d2,d5,d8},d4} Then d2,d5,d8 are in the same position.

Pos.       | Relevant d1         | 1 d3         | 1 d2,d5,d8   | 1 d4         | 0 

So R-Precision in the first 3 positions is R-Precision = 1, right? Or do I count them as:

Pos.       | Relevant d1         | 1 d3         | 1 d2         | 1 d5         | 0 d8         | 0 d5         | 0 

Can the artificer Magical Tinkering be used to falsify documents?


Magical Tinkering. A static visual effect appears on one of the object’s surfaces. This effect can be a picture, up to 25 words of text, lines and shapes, or a mixture of these elements, as you like.

If I had an identification paper, could the class ability be used to replace some of the words and the image on the paper? Or maybe be used to create a “fake” emblem on the document?

PDF Documents – Browser View 2020

I posted a question yesterday about PDF files in a browser that can be found here. There you can find more information about dealing with PDF documents in browser.

My question here is how each browser handles PDF files by default.

PDF files can cause security concerns because the have the capability to contain executable code.

What I have found is that some browsers today have their own PDF viewers. Some of those viewers open in a sandbox environment which at least seems to protect the end user. I have confirmed that both Chrome and Firefox open PDFs in a sandbox environment.

Question 1:

Do the following browsers also open PDFs in a sandbox (2020)?

  • Edge?
  • IE?
  • Safari?

Now these sandboxes sound pretty great if they can mitigate any security concerns with PDF files. My next series of questions regard the sandbox environments.

Question 2:

Is there any way a user might disable the protections a sandbox provides?

Question 3:

Are there still concerns when opening a PDF in a sandbox?

Question 4:

Are there easy ways to verify a user is opening a PDF in the correct browser or with the correct settings before opening?

PDF Documents in Browser 2020

I have a project where I would like to allow a user to view a document (PDF) in their browser by clicking on a link or thumbnail of the file. They would be able to download said file. Ive just begun to research the vulnerabilities associated with PDF files but here is what I can gather so far:

PDFs can contain executable code that could create exploits or identify other exploits. PDFs are not unique in this regard.

To protect against any malicious PDF action occurring, browsers now open all PDF files in a sandbox. These sandboxes can be more secure than local viewers. Browsers that open PDF files in a sandbox:

  • Chrome : yes
  • Firefox : yes
  • Edge : ?
  • IE : ?
  • Safari : ?

I plan to store the PDF files on the file system outside of web root. The files meta data will be indexed inside a database.

Communication will be over SSL.

Questions:

  1. Does opening a PDF file in a browser sandbox eliminate risks with displaying PDF in browser?
  2. Are there more ideal file formats (from a security standpoint) to use over PDF for the use case described?
  3. What types of server side validation could/should I perform when displaying a PDF document?

Should I present forged documents in a Penetration Test/Red team engagement?

A previous question of mine lead to this discussion which mentioned the subject of Document forgery.

I’ve seen many people (in videos) forge IDs and employee badges for such engagements so that seems fine as a test. However, if asked to present a more critical/serious document like a “Permission to Attack” slip (when caught), or asked by a police officer to present some ID, should we test them by first show them a forged “Permission to Attack” slip or ID and only show the real documents if caught?

How can I replicate the native look & feel of Fate documents?

Fate documents (whether they are rule books, adventure books, character sheets, etc.) generally have a pretty recognizable style (a typical example is the Fate Core Character Sheet). The rule books have pages with a specific layout, a specific style for page numbering, specific shapes around the edges, specific shapes for sections with GM tips, specific shapes for sections with examples, etc.

As a GM, I sometimes want to create customized sheets and handouts. Possibly I’d like to write and publish an original setting or adventure at some point. In either case, I would prefer to make something that feels like a ‘native’ Fate document (considering that the folks at Evil Hat have said they don’t mind people doing so).

How can I go about replicating that look & feel in a rich text editor or DTP software? (To me, it doesn’t matter which specific product I’d have to use.) Are there any reusable templates made by players that make this process repeatable? Is there perhaps a visual style guide that authors can follow? Anything instructions to avoid ‘reinventing the wheel’ or at least be able to ‘reinvent’ it faithfully?

Querystring filter on documents

I have a list of documents who have a property (Related document ID) that I want to filter via query string

Example:

site.com/document?PolicyID=1 

should view only documents who have the related ID = 1

I was thinking of using a Highlighted Content web part with a custom CAML query.

This is what I have so far:

<View> <Query> <Where> <Eq> <FieldRef Name='Related_x0020_Document_x003a_ID'/> <Value Type='Text'>{QueryString:PolicyID}</Value> </Eq> </Where> </Query> </View> 

Can anyone with a basic understanding explain how it works?

I just want CAML to accept a query string

How to display same APP ID documents from SP library

i have infopath form which was published on SP library. In SP library We are storing documents based on App ID. and every time while changes in Application new Token no. generated.

if it is possible, if i select App ID and in background it will search all changes with same App ID and display all changes details like document preview. some thing like that.

In simple words, many records stored in my SP Library. Every records have different token numbers and some records have same APP ID. so i am trying to implement if i filter APP ID “12345”. each and every records could be display as preview.

Thanks