You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this namespace is mongodb's collection and field ?
in this example, namespace == "users.users" ,namespace == "users.status", "users" is collection name? "status" is mongo document's field name?
funcPipeBuilder(namespacestring, changeStreambool) ([]interface{}, error) {
// to build your pipelines for change events you will want to reference// the MongoDB reference for change events at // https://docs.mongodb.com/manual/reference/change-events/// you will only receive changeStream == true when you configure gtm with// ChangeStreamNS (requies MongoDB 3.6+). You cannot build pipelines for// changes using legacy direct oplog tailingifnamespace=="users.users" {
// given a set of docs like {username: "joe", email: "[email protected]", amount: 1}ifchangeStream {
return []interface{}{
bson.M{"$match": bson.M{"fullDocument.username": "joe"}},
}, nil
} else {
return []interface{}{
bson.M{"$match": bson.M{"username": "joe"}},
}, nil
}
} elseifnamespace=="users.status"&&changeStream {
// return a pipeline that only receives events when a document is // inserted, deleted, or a specific field is changed. In this case// only a change to field1 is processed. Changes to other fields// do not match the pipeline query and thus you won't receive the event.return []interface{}{
bson.M{"$match": bson.M{"$or": []interface{} {
bson.M{"updateDescription": bson.M{"$exists": false}},
bson.M{"updateDescription.updatedFields.field1": bson.M{"$exists": true}},
}}},
}, nil
}
returnnil, nil
}
The text was updated successfully, but these errors were encountered:
this namespace is mongodb's collection and field ?
in this example, namespace == "users.users" ,namespace == "users.status", "users" is collection name? "status" is mongo document's field name?
The text was updated successfully, but these errors were encountered: