sharepoint online – Creating a custom control/action for a document library

I am wondering if it is possible to add a custom control/action for files in a document library in SharePoint. For example, when I select a file or click the ellipsis for a file I get the options to preview, share, copy link, download ,etc… I want to know if it’s possible to create my own custom option for this which will trigger a ms flow and pass the file properties to ms flow?
To be more specific, I already have a ms flow that automatically picks up files when they are uploaded to sharepoint and copies these files to a different environment. I just need to see if I am able to implement a custom option, when you click that option it will trigger the flow for that file and copy the file to the different environment or if it is even possible to add custom options for files in a document library.

enter image description here

python – Regex matching an optional part of a document?

I have a plain text document that contains varies freeform records that look like one of these two:

Title: Red car
Date: 2021-02-10
    
Description: This car is very red.
It goes very fast.

There are many like it but this one is mine.

Second:

Title: Blue truck
Date: 2021-02-11
    
Description: The truck is blue.
It carries a lot of stuff.

Notes: This one looks damaged.

I’m trying to use a regex in Python3 with named groups to capture the fields. The “Notes” field in optional. The closest I’ve gotten is:

(?:Description:)(?P<description>.+?)nn(?:Notes:)?(?P<notes>.+)?

But it’s still capturing text into “notes” even when the word “Notes:” doesn’t appear in the document. Any suggestions?

sharepoint library – Document libraries: Can you HIDE columns in a parent directory but SHOW them in children directories?

The parent directory of my document library contains folders. When I get into one of these folders, I want to be able to see the columns I’ve created, but NOT see them when I’m in the parent directory.

I’ve looked in the library settings but can’t seem to find anything about this.

Is there a way to do this out-of-the-box in SharePoint?

Any good VR concept document examples?

Just wondering if anybody could share some examples of VR concept documents, for either games or productivity apps. And would be nice to see some from successful products, especially from larger companies.

Is there much of a difference between VR concept documents and traditional software ones?

database design – 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"
                    }
                }
            }))

How can I delete several pages of text from my Google Docs document?

I have a Google Docs file that contains about 250 pages of text. Only pages 180-230 apply to me, so I wanted to delete the unnecessary pages from the document.

I have tried to drag my cursor over the text, but of course, this is very unpractical as there are hundreds of pages I would have to drag my cursor over.

So, is there any way for me to select the text on select pages in the document and then delete it?

Thank you for your time.

sharepoint online – Disable navigating up in embedded document library

I embedded a document library on my SharePoint site using a custom embed Web Part.

The embed code looks like this:

<iframe src="https://myorg.sharepoint.com/sites/mysite/Documents/Forms/AllItems.aspx?RootFolder=%2Fsites%mysite%2Fmyfolder" width="500" height="500"></iframe>

It works great.

However, I’d like to prevent users from exiting the RootFolder. They can currently do so by clicking the navigation bar at the top.

Is this possible?

mongodb – “Document Failed Validation” what is wrong with my schema validation

I am trying to create a collection with JsonSchema (really its “BsonSchema”) validation. This is a document that I want to insert (with bogus values). Note that Id is coming from the mongo c# driver as the ObjectID via StringObjectIdGenerator.

{
  "Id": "602ff3ed562ec58cb18c37c3",
  "UserId": 2,
  "UserName": "UserName_1",
  "Password": "Password_1",
  "PasswordSalt": "InstallSchema",
  "CreatedDateUtc": "2021-02-19T17:22:50.86151Z"
}

This is one of the many schemas that I have tried to use.

{
  "bsonType": "object",
  "properties": {
    "Id": {
      "bsonType": "objectid"
    },
    "UserId": {
      "bsonType": "int"
    },
    "UserName": {
      "bsonType": ( "string", "null" )
    },
    "Password": {
      "bsonType": ( "string", "null" )
    },
    "PasswordSalt": {
      "bsonType": ( "string", "null" )
    },
    "CreatedDateUtc": {
      "bsonType": "date"
    }
  },
  "required": ( "UserId", "UserName", "Password", "PasswordSalt", "CreatedDateUtc" )
} 

When inserting the document into the collection it reports “Document failed validation” with no more specific detail. I know the document is correct, its the schema that is not, but I cant figure out what is wrong with it. I’ve tried different variations of the Id property including _id, a string type, and removing it completely, but I dont know if thats even the problem. Any ideas on how to figure this out?

Also I did try creating the collection without schema validation and the document inserts fine. Then in Compass, I ran analysis for the collection and exported what it calls a schema (a very different format from the validator schema) and the properties and types match the schema above.

database design – MongoDB concurrent update to same document is not behaving atomic

Currently, we have an orderId for which we give the benefit(posting) to the user. There are multiple events that can trigger benefit/posting. But the condition is that only 1 event should be triggered. Hence for handling current requests, we created a boolean field POSTING_EVENT_SENT, initially set to false, and later whoever was able to mark it as true can proceed further.

public boolean isOrderLockedAndUpdatedToTriggerPosting(String orderId, OrderStatus orderStatus) {

       Query query = new Query();
       query.addCriteria(Criteria.where(OrderConstants.ORDER_ID).is(orderId));
       query.addCriteria(Criteria.where(OrderConstants.POSTING_EVENT_SENT).is(false));
       Update update = new Update();
       update.set(OrderConstants.ORDER_STATUS, orderStatus);
       update.set(OrderConstants.UPDATED_AT, new Date());
       update.set(OrderConstants.UPDATED_IP_BY, deploymentProperties.getServerIp());
       update.set(OrderConstants.POSTING_EVENT_SENT, true);
       update.set(OrderConstants.UPDATED_BY, OrderConstants.UPDATED_BY_WORKER);
       UpdateResult result = mongoTemplate.updateFirst(query, update, OrderDetails.class);
       return result.getModifiedCount() > 0;
   }

this is the mongodb query that code is trying to execute

db.order.update({orderId : 123, paymentEventSent: false},{$set : {paymentEventSent: true}})

So we’re checking if the field is false, then mark it to true. So theoretically only 1 request will be able to do the same, because the mongo queries are atomic. But in our scenario, both the concurrent queries were updating the records successfully. What else we’re missing here?