Do any pattern exists for renaming live a MongoDB collection?

Do any pattern exists for renaming a MongoDB collection live in production environment? The collection is accessed both for reading and for writing in a non sharded environment. The requirement is to not have downtime. Some different microservices access the collection in different ways. The result must be obtained in a progressive way, releasing updated services independently from each other.

For relational databases several patterns were discovered and documented in the excellent book Refactoring Databases: Evolutionary Database Design by Scott Ambler and Pramod Sadalage and I would have used the Rename Table pattern to implement if the database was relational, that but it seems that with MongoDB this is not possible.

Rename a variable in a pattern by an evaluation

I wish to take some expression containing instances of Pattern[], and rename the variables of those patterns based on evaluation featuring the variable.

Let’s say my renaming function is

f[s_Symbol] := Symbol[ SymbolName[s], "2" ] 

which just appends 2 to symbol names:

f[a] >>> a2 

If I try to replace Pattern variables with this function (or any expression), that expression remains unevaluated!

a_ /. a :> f[a] >>> Pattern[ f[a], _ ] 

I assume Pattern holds its first argument.

Naturally my example is strange since simplified; I really intend to replace any symbol (which may or may not be featured in a Pattern) which satisifes certain properties.

a_ /. s_Symbol /; someTest[s] :> f[s] >>> Pattern[ f[a], _ ] 

How can I force Pattern to evaluate its first argument after my substitution?

I cannot just insert an Evaluate into the RHS of my DelayedRule (though that solves my first example), since this just violates the rule delay, and invokes f[s].

CHECK Constraint to enforce upper case letter and pattern match

For one of my columns I am trying to enforce a pattern. The first letter should be D upper case, and the remaining 3 characters should be digits. For example:

D678, D890, D000

I’m quite new with CHECK constraints and things like regular expressions.

Below is what I’ve done so far, which (I think) enforces the general pattern. However when I try adding something like d900 it works, even though it’s a lower case d. I expected this to fail.

Can someone please assist:

CREATE TABLE Systems( SystemsID NVARCHAR(4), Title NVARCHAR(30), CONSTRAINT chk_SystemsID CHECK (SystemsID LIKE '[D][0-9][0-9][0-9]')); 

Singleton Pattern & global var access alternatives

I know this is a controversial topic being discussed a lot , but I have not found a clear answer yet. So , there is a "Grid" in my game , which I implement it with an Array of GameObjects. This array should be accessed by different scripts in my game. My approach , is that I have a Game Manager , which is a Singleton , the array is public , and every script that needs to access it or make a change can do something like GameManager.Instance.GridArray[i,j]; .

Using singleton and public variables are heavily criticized for extensibility and coupling issues. What approach would be better for this situation ?

Permutation Combinations Mobile Pattern Codes [closed]

Please help write codes to determine 4 to 6 dot patterns. I am stuck after permutations input. It would really help if one could write direct so I could copy paste code to determine list of 4 to 6 dot patterns. Pl refer article. I have uploaded jpeg of the error I am facing Code error at =Flatten[{#, Reverse@#} & /@ Partition[{1, 3, 4, 6, 7, 9, 1, 7, 2, 8, 3, 9, 1, 9, 3, 7}, 2], 1]

Pattern for access controlled client side encryption

How would you design a server/client system where a client is granted a key to encrypt/decrypt data, but the key could be revoked/redistributed by the server? Data encrypted prior must still be readable with the new key.

A simple scenario:

  1. Client wants to send a document to a server
  2. Client encrypts the document with some client-side credentials and sends to server
  3. Server receives document and stores in database
  4. Client requests document, receives, then decrypts. The roundtrip is complete.

Now, suppose the client credentials are compromised and key used to encrypt/decrypt data is stolen. The client changes their password, etc, but the key that can decrypt incoming data is still an issue.

My question is about redistributing an encryption key without having to re-encrypt all of the clients data. Are there any patterns that can help me with this? It feels like a variation of symmetric encryption with a KEK and DEK, but I’m having trouble figuring out how to encrypt something on the client side without exposing the DEK.

Why association pattern unmatched when using variable

I have association and want to replace integer in specific element in this association. I’m trying to build pattern to be used by ReplaceAll command. When number is explicitly provided in pattern match occurs, but when I put number in a variable and provide number from variable match fails.

In[1]:= MatchQ[<|id -> 6, dur -> 10, skill -> 1, succ -> {7},    dl -> 250|>, <|la___, succ -> {l___, 7, r___}, ra___|>]  Out[1]= True  In[2]:= last = 7 last[[0]]  Out[2]= 7  Out[3]= Integer  In[4]:= MatchQ[<|id -> 6, dur -> 10, skill -> 1, succ -> {7},    dl -> 250|>, <|la___, succ -> {l___, last, r___}, ra___|>]  Out[4]= False 

As shown in this example first match occurs, but second fails with number in variable.

Security pattern for third party uploads to Azure blob container


  • Vendor 1 needs to upload data to an Azure blob storage container owned by Vendor 2
  • Vendor 1 is issued a limited duration SAS token each day to use
  • Azure does no scanning of incoming blobs (therefore content is untrusted when it lands)
    • Microsoft recommends pre-scanning all files before uploading


  • What is a repeatable pattern for Vendor 2 to secure this type of content unpload against malware threats?