Skip to content

Instantly share code, notes, and snippets.

View AmitDJagtap's full-sized avatar
💭
rabbitmq this and rmq that

AmitDJagtap

💭
rabbitmq this and rmq that
View GitHub Profile
@AmitDJagtap
AmitDJagtap / Example 2.js
Created November 2, 2019 08:37
Example 2. Modelling One-to-Many: Reference parent document from child documents
//Primary Collection
[
{
id: ObjectID('AAAA'),
partno: '123-aff-456',
parentCatalogNo: 1234,
name: '#4 grommet',
price: 3.99
},
{
@AmitDJagtap
AmitDJagtap / Person.js
Created November 2, 2019 08:33
Modeling One-to-Few - Embedding
{
name: 'Kate Monster',
ssn: '123-456-7890',
contacts: [
{number : "+1990112112", type : Mobile, title: 'my home1' },
{number : "+230112112", type : LandLine, title: 'my office' }
]
}
FROM golang:1.10 AS builder
# Download and install the latest release of dep
ADD https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 /usr/bin/dep
RUN chmod +x /usr/bin/dep
# Copy the code from the host and compile it
WORKDIR /go/src/mygolangcode
COPY Gopkg.toml Gopkg.lock ./
RUN dep ensure --vendor-only
curl -k -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X PUT \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "containers": [{ "image": "'${IMAGE}'", "name": "'${NAME}'" }], "imagePullSecrets": [{ "name": "'${REGISTRY_SECRET}'", "type": "/v3/project/schemas/localObjectReference" }], "name": "'${NAME}'", "namespaceId": "'${NAMESPACE}'", "projectId": "'${PROJECT_ID}'", "scale": "'${SCALE}'", "workloadLabels": { "workload.user.cattle.io/workloadselector": "'${WORKLOAD_SELCTER}'" } }' \
'https://my-rancher-server-url/v3/project/'${PROJECT_ID}'/workloads/deployment:'${NAMESPACE}':'${NAME}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
annotations:
name: ecr-cred-helper
namespace: default
spec:
concurrencyPolicy: Allow
failedJobsHistoryLimit: 1
jobTemplate:
# NOTE: The service account `default:default` already exists in k8s cluster.
# You can create a new account following like this:
#---
#apiVersion: v1
#kind: ServiceAccount
#metadata:
# name: <new-account-name>
# namespace: <namespace>
---
apiVersion: batch/v1beta1
kind: CronJob # Tell kuber' that this is a cronjob
metadata:
annotations:
name: ecr-cred-helper # Name of the job ,can be anything
namespace: default
spec:
concurrencyPolicy: Allow
failedJobsHistoryLimit: 1
jobTemplate: