I want to know is there any
trigger kind of functionality exist in MongoDB which can help me to run my mongo command on
Basically, I want to run a specific set of Mongo queries on
find query. You can say a
find query to run other mongo commands.
As at MongoDB 3.4, there is no server-side functionality for query listeners or triggers. There are some open feature suggestions for triggers in the MongoDB Jira issue tracker, but these all appear to be associated with operations that update data (insert, update, delete) rather than
Other than that is there anything like
create a view from a remote database, I know MongoDB provides creating a view from the same database but I want from the
As at MongoDB 3.4, there is no in-built feature for creating views from remote databases or deployments.
I do not want any application level solution like any third party module or watcher script, I want something which is within the MongoDB itself like inbuilt function or any event handling.
Although you've excluded third party solutions, there are currently no built-in features or feature requests matching your description. You could certainly raise one or more feature requests with a description of the use cases, but I think both of these approaches sound more suitable for implementing in an application layer with your business logic rather than embedding that into a distributed database.
As a more general solution to enable the use cases you've described, I suggest putting an API layer between your applications and your MongoDB deployment. The API layer could intercept queries and perform the desired actions based on your use case, and is an option available to you without any dependencies on MongoDB server features.
I have tried auditing but, it only records the operation and all, does not provide any handler through which I can run my mongo commands
like Oracle providing in Fine-grained auditing.
The auditing feature (which is part of MongoDB Enterprise) is only intended to record configured operations of interest. If you want to do special processing based on queries you will have to implement this in your own application code.