Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: i want to be write below code in Service API with Jax-rs Restful Date: Tue, 5 Jun 2018 21:21:35 -0400 Organization: Aioe.org NNTP Server Lines: 17 Message-ID: References: <8c24dddd-9932-450c-a26b-6b70885e64a3@googlegroups.com> NNTP-Posting-Host: PBuS014lhzVyHjLbXmo/ZQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:38346 On 6/5/2018 5:56 AM, siddareddy.moolam@gmail.com wrote: > code: > MongoClient client = new MongoClient("localhost", 27017); > MongoDatabase database = client.getDatabase("admin"); > MongoCollection collection = database > .getCollection("command"); > > Object id = new ObjectId("5b16371c425750918ebf1454"); > Document newCmd = new Document("d", 4); > collection.updateOne(Filters.eq("_id", id), Updates.addToSet("cmd", newCmd)); So you write a JAX-RS service class with a @Path annotation and an update method with a @Post or @Put annotation. Arne