How to create view in mongodb using spring data mongodb? Thanks
You can inject bean of type org.springframework.data.mongodb.core.MongoTemplate where you need it and use one of its methods executeCommand, for example executeCommand(String jsonCommand) in folowing manner:
mongoTemplate.executeCommand("{ create: <view>, viewOn: <source>, pipeline: <pipeline> }");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With