6, Use positional operator to update all items in an array; array mongodb. GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString,. An object reference can point to any derived type instance. Introduction In our previous blog post we saw how to perform Read and Write operations in MongoDB using SSIS (i. So I would like to insert a new array to the arrays of arrays at 2nd position of every unidades_ array. PubNub Staff @pubnub. Add support for multiple conditional updates in a single update operation. Returns: An instance of UpdateResult. This worked to a point, exactly one level (Account) but my encoding failed to reach down to the Address arrays embedded within. Is there a more concise way of doing this? Essentially, I am trying to find a better way of updating an object inside of an array in a BsonDocument. Suppose, we want to get the contact’s name and the first phone number, we use the following query:. In the previous part of Paging with the Bucket Pattern, we reviewed the powerful bucket pattern and ways of leveraging it for easy and efficient paging. Introduction MongoDB is one of the most poplar NoSQL database out there. htaccess file that is used to provide URLs without the index. I need to update the document's array element in mongodb, I have multiple ids of that array. There is already $ operator available in mongo but how we can use in this library. mongodb,mongodb-query. MongoDB/PHP how can I find and remove an element of document inside array? PHP. So unless you replace the waterline ODM/ORM you are pretty much stuck with this AFAIK until there is a decision to maintain this logic in a way that is more consistent with the MongoDB API or otherwise allow access to the "raw" driver interface to perform these. Requires MongoDB 3. com Updating Inside a Nested Array with the MongoDB Positional Operator in C# Sometimes you have a document in MongoDB with a property that is an array of nested objects. Bulk Import a CSV File Into MongoDB Using Mongoose With Node. OF Operator It is common to perform a calculation using all of the variables or elements that are associated with an array. I need to be able to push a document to that array, and keep it in sorted (or roughly sorted) order. C# Object Array This C# program uses object arrays, which store many types of elements. One answer I will give (although this is really better as a discussion, as the comments above point out): If you connect from either a Cloud Service (web/worker roles) or Virtual Machine, you can have a direct internal connection to MongoDB if you're hosting it in a Virtual Machine. public abstract static class ListChangeListener. If that user queries a table, there’s an object. After insert the code array. FEATURE DESCRIPTION MongoDB 3. You can remove one or more elements with -=:. To project, or return, an array element from a read operation, see the $ projection operator instead. Adding Elements. On an insert, if the account already exists, an update is done instead. The MongoDB Operators is defined as a character that is used to store characters values basically as a part of MongoDB database. You have learned so far that you can easily query and add values into an array; using the same appraoch you can also remove entry in an array. update or change the field 'number' and 'updated_at' in a JSON element of 'alpha' array Not all of MongoDB's query syntax / capabilities are implemented in Azure Cosmos DB: MongoDB API. In t his php mongodb tutorial you will learn how to fetch, insert, edit, delete records in a mongodb collection using php. In a previous NodeJS mongodb tutorial we explored how to perform CRUD operations on mongdb database using nodejs. As mentioned MongoDB stores its data in documents. How to Insert a document with array of subDocuments into MongoDB by C# classes? I want to update object inside array in mongodb with java programm. reactivestreams. MongoCollection. Declaring array columns in tables:. Mathias Unfortunately this is not possible to do this directly with the $ positional operator since it only updates the first matching element of the array. It then adds these two arrays. The array contains an array of strings. Hello MongoDB-user list, What is the correct way to upsert one element in an array, when the array contains object/documents? For example, use this record:. MongoDB is one of the most important databases you can work with these days. update({"_id":ObjectId("someid"),"notifications. find method in the MongoDB Java Reactive Streams Driver. I need to find OrderItemId is 'yyy' and update. This doesn't use index as a criteria for removing an element, but still might help in cases similar to yours. MongoDB Query: Select and Filter Child Array By Brij Mohan If you are using embedded document to model one to many relationships in MongoDB , sometimes you might need to get child data only depends on the report. Access Elements of a Nonscalar Struct Array This example shows how to access and process data from multiple elements of a nonscalar structure array: Create a 1-by-3 structure s with field f :. $': 1}); MongoDB 3. 12 ) you can now update multiple array elements in a single request. Array is instantiated when we assign a value using the equals operator. Before going to see different types of update operations in MongoDB, now let's have a look at the structure of the basic update command in MongoDB. NET driver 2. I've noticed that the documentation at https://docs. Step 2: Process the JSON Data. When using splice to add elements to an array, the second argument would be zero. but it is not working how to achieve this scenario. MongoTemplate and MongoRepository. The first element in the array is [0], the second element is [1], and so on. Also check, how to select documents in MongoDB with Monk. The _id field is unique to a document collection and contain any BSON data type value except an array. It is For Each Loop or enhanced for loop introduced in java 1. 6, "How to update documents in a MongoDB collection with Casbah. OrderItemId" is array. Then insert the array with 4 document. This query is what filters the documents that we are wanting to update. The first argument to update() is the query. To remove an element completely from an array completely, we need to merge two sub-arrays: First sub-array will consist of all those elements present before the element to be removed and Second sub-array will contain all those elements arriving after the element to be removed. Remove elements with -= or --=. Array is instantiated when we assign a value using the equals operator. The person who asked this question got a lot of reputation points, which could grant him permissions to do a lot of things on Stack Overflow. And what’s with push/pop? They do not need to move anything. Inside that latter array (element 2 of every unidades_ array) there are many arrays. NoSQL Database Types. If we want to perform any action on an array, we must repeatedly perform that action on each element in the array. Because we are matching on the address field which resides in a record inside of an array, and one of the fields we want to mutate (last) also exists in the array, the. I am looking for the MongoDB C# 2. This option is available in MongoDB 3. --You received this message because you are subscribed to the Google Groups "mongodb-user" group. In our previous blog post we saw how to update / delete mongodb array item. updateOne({select}, {update}, {upsert}) Select : option is used to select the particular document which you want to update. 6 aggregation and array improvements. In this tutorial, we’re going to illustrate the broad range of operations where the Spring REST Client – RestTemplate – can be used, and used well. You have exceeded the maximum character limit. The _id field is unique to a document collection and contain any BSON data type value except an array. One workaround you can use is to reverse the order of the array so the first element is the one you want to update. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents. The TBODY element of the HTML Table has been assigned directive in order to iterate through all the items of the JSON array. • Often data come naturally in the form of a table, e. this will find all documents where "juan" is an element inside the "actors" array. but it is not working how to achieve this scenario. To project, or return, an array element from a read operation, see the $ projection operator. When we need to “expand” those user objects we are going to use populate method provided by Mongoose. 🤩 MongoDB GO driver is pretty easy and quick to set up. Array's elements are accessed using their index, which starts from 0. 0 is just around the corner and with rc0 we can get a good idea of what we can expect in the GA version. The following is an example of creating a simple array and then accessing the first element, which is at index 0. When using entities with properties or fields that serialize to arrays, you can use the methods prefixed with “Any” to compare the entire array against a single item. You forgot to provide an Email Address. Welcome to Day 4 (Believe me it will take more than one day) of MongoDB Tutorial. The json library was added to Python in version 2. connect to connect to the database. Array is an index based data structure which is used to store elements but unlike Collection classes like ArrayList or HashSet which has contains() method, array in Java doesn't have any method to check whether an element is inside array or not. For more information, see Array Indexing. Indexing: If an array field in MongoDB is indexed, then one document within the collection will be responsible for a distinct entry in that index for every single element it the array. Cara Yoakum Staff asked 9 months ago. Map[String,String] = Map() You can add an element to a map by assigning a key to a value:. We said that Save() works as an Insert if the document ID is not found. Nothing happen, but If I use 0 instead of $, the (wrong) element on array is changed – Dherik Mar 7 '18 at 17:07 @Dherik Do you have a question already with the details for your problem? If not can you create one with a sample document and your desired result? – chridam Mar 7 '18 at 17:32. paging subdocument in mongodb subdocument. MongoDB uses dot notation to fetch values from elements of an array and fields of an embedded document. First, you need to connect to MongoDB using Monk, by firing the following lines of code. 0) EDIT: Not looking for the javascript way of doing this. updateOne({select}, {update}, {upsert}) Select : option is used to select the particular document which you want to update. For the document matching the criteria _id equal to 100, the following operation updates the value second element (array index of 1) in the tags field and the rating field in the first element (array index of 0) of the ratings array. Showing Array Values in Text Component one by one like ListView. org/manual/reference/operator/projection/elemMatch/ or @http://docs. Arrays of strings are all good and well, but there are simpler, more modern ways of data processing. Insert New Order inside existing Customer Document) Support for SQL Server 2005, 2008, 2012, 2014, 2016 (32 bit and 64 bit. For example: int age[100]; Here, the age array can hold maximum of 100 elements of integer type. To update all elements in an array, see the all positional operator $[] instead. We want to update the values of a given array with their absolute. TokuMX can probably handle 100-element indexed arrays fine, 1000 might be alright, 10000 is probably pushing it, but again, it's just a multiplicative factor on top of your application's throughput so YMMV. This post is part of a series called An Introduction to Mongoose for MongoDB and Node. I need to update the matching element in that array. The array contains an array of strings. This draft has also taken more time than expected because it tackles deep, long-term issues that have long been a challenge for JSON Schema. MongoDB – Remove a field from array. In this video tutorial, w. Find Document by ObjectID inside Array with CosmosDB and MongoDB API I'm trying to find a Document by ObjectID inside an array using CosmosDB and Mongoose and it isn't working. NoSQLBooster for MongoDB provides in-place editing in result tree view. To post to this group, send email to mongod@googlegroups. Much Like XML. After insert the code array. You forgot to provide an Email Address. If you do want to maintain ordered arrays, MongoDB 2. After that, we have used the Select element and pass the options object. This page provides examples of query operations on an array of nested documents using the com. In this case we are trying to see if there is a matching SubDo. cara update element array di mongoose gimana ya ? ini struktur dokument nya [code] username : String, notification:{ id:String,usernam. Value ' dynamically add value to the end Next Dim arr() As Variant arr = toArray(col) 'convert collection to an array Function toArray(col As Collection) Dim arr() As Variant ReDim arr(0 To col. indexOf() or Array. updateOne({select}, {update}, {upsert}) Select : option is used to select the particular document which you want to update. " Vote Up 0 Vote Down Reply 5 years ago. In MongoDB the $elemMatch projection operator is used to limits the contents of an array field which is included in the query results to contain only the first. An Introduction to MongoDB Query for Beginners. Update field in exact element array in MongoDB - You can update the in exact element array in MongoDB with the help of below statement The syntax is as follows yourArrayDocumentName yourNestedArrayDocument yourPosition yourValue To understand the above syntax let us create a collection wi. It may also be utilized to add new items, but we won't be making use of that feature here, so we'll leave that part for another day. Let's get started. This tutorial will give you great understanding on MongoDB concepts needed to create and deploy a highly scalable and performance-oriented database. updateOne({select}, {update}, {upsert}). Step 1) Create a JavaScript variable called myEmployee to hold the array of documents. A solid intro to using MongoDB in with Spring Data. Just want to add one point. They introduced this enhancement to make Craft more secure. In this article you will learn how to use ZappySys MongoDB Destination Connector to perform various bulk operations on MongoDB such as Insert, Update, Delete and Upsert. Finding Array Elements with Array#indexOf. It's now regarded as feature complete and ready for production use. One answer I will give (although this is really better as a discussion, as the comments above point out): If you connect from either a Cloud Service (web/worker roles) or Virtual Machine, you can have a direct internal connection to MongoDB if you're hosting it in a Virtual Machine. find method in the MongoDB Java Reactive Streams Driver. This option is available in MongoDB 3. Updating Data Objects Nested In Document Arrays In MongoDb data objects deeply nested inside the ‘questions’ array. Full MongoDB data type support in the in-place editor, enabling lossless editing and saving. Question Bank › Category: MongoDB › How to Update Multiple Array Elements in mongodb. An Introduction to MongoDB Query for Beginners. MongoDB Query: Select and Filter Child Array By Brij Mohan If you are using embedded document to model one to many relationships in MongoDB , sometimes you might need to get child data only depends on the report. MongoDB reserves field names that start with "_" and "$" for internal use. When the elements are thus arranged, there is a recurring pattern called the ‘periodic law’ in their properties, in which elements in the same column (group) have similar properties. is an array of objects. We can quickly see in the new changelog exactly what commits contain breaking changes and so can application developers when they are deciding whether to update to a new version of AngularJS. Cook, Serve, Delicious! 2!! free steam key on SteamGateways. Update An Array Field. Update nested array with Mongoose - MongoDB Tag: javascript , arrays , node. Our example replaces the 2nd element of the ArrayList by calling the ArrayList. We access array elements using the subscript within square brackets []. 9, “How to Delete Array and ArrayBuffer Elements in Scala” Problem. MongoDB Class Notes. Let’s say you have a collection in your MongoDB with one of the fields as an array of array. If you need to find the position of an element or whether an element exists in an array, use Array. python,mongodb,pymongo. 4 added two helpful features related to this use case: Ability to push to fixed-sized arrays; Ability to push to arrays sorted by embedded document fields. MongoDB – Remove a field from array. Likewise i want to insert the sample array element in MongoDB. Tunable consistency levels: Because Azure Cosmos DB supports multi-model APIs the consistency settings are applicable at the account level and enforcement of the consistency is controlled by each API. NET Driver Untyped API (using BSON Documents) Docs where a is an array with exactly 3 elements. Let's get started. But we will also explore the complexities introduced due to arrays. If the query field in condition is an array, like below "OrderItems. ini file inside. find({"shapes. The last element (right most) of the list has the index -1, its adjacent left element is present at the index -2 and so on until the left most element is encountered. Given the following class: public class Post { public IEnumerable Tags { get; set; } } To see if any of the tags equals “mongodb”:. Returns: An instance of UpdateResult. See below for examples. A simple C# POCO can be serialized as a document and stored by MongoDB. $[] Acts as a placeholder to update all elements that match the arrayFilters condition for the documents that match the query condition. After insert the code array. FEATURE DESCRIPTION MongoDB 3. Step 3) Use the insert command to insert the array of documents into the collection. The OPENJSON function takes a single JSON object or a collection of. Hi Mateo, Direct query the last item in an array is currently not supported in MongoDB. And like me, sometime ago, you might wonder how you can update data in a particular array's child object without knowing the exact position of the child. Introduction In our previous blog post we saw how to perform Read and Write operations in MongoDB using SSIS (i. This option is only supported on MongoDB 3. They store elements of different types in a single collection. Index can also be build on an multi-valued attribute such as an array. NoSQLBooster for MongoDB support in-place editing in result tree view. We provide a "template" as a high-level abstraction for storing and querying documents. Here's a simple pipeline to add up each Nth element from each array: db. connect to connect to the database. Dim col As New Collection For Each a In range. If anyone have this problem, the solution is to create 2 "MongoDB Output". An array DBMS is a kind of NoSQL DBMS that allows modeling, storage, and retrieval of (usually large) multi-dimensional arrays such as satellite images and climate simulation output. Returns: An instance of UpdateResult. Though this is possible to do with some real wrangling you would be best off changing the document structure to "flatten" the array entries into a single array. In this case, we have used Insertion sort. Based on my test , It seems that Azure Cosmos DB: MongoDB API does not support Array Update now, this feature will be supported in future. In this case we are trying to see if there is a matching SubDo. In this article you will learn how to use ZappySys MongoDB Destination Connector to perform various bulk operations on MongoDB such as Insert, Update, Delete and Upsert. but it is not working how to achieve this scenario. Specifically, we'll expand on the array update operators. One thing that I've seen people store in MongoDB documents are "parallel arrays" - when there are two arrays that are somehow correlated, the first element in each array are related, so are the second ones, etc. Now let's look at how to Upsert MongoDB Array Items (i. Update Elements Match arrayFilters Criteria ¶ Create a collection students with the following documents:. One answer I will give (although this is really better as a discussion, as the comments above point out): If you connect from either a Cloud Service (web/worker roles) or Virtual Machine, you can have a direct internal connection to MongoDB if you're hosting it in a Virtual Machine. I've noticed that the documentation at https://docs. With the release of MongoDB 3. Notice that each employee contains a field called courses which again is an array of documents where each document is a course and has fields name and type. When users subscribe to a show this is how its MongoDB document may look: Again, we are not storing actual users inside subscribers array, only ObjectId references to those users. MongoDB Operators are utilized to implement conditions in Mongodb database and provides services and provide different number of conjunctions in an announcement. Find Document by ObjectID inside Array with CosmosDB and MongoDB API I'm trying to find a Document by ObjectID inside an array using CosmosDB and Mongoose and it isn't working. Description. Inside that latter array (element 2 of every unidades_ array) there are many arrays. Let’s start. You can use the OVERLAY keyword to overlay one array over another. Also check, how to select documents in MongoDB with Monk. So, it is possible in MongoDB for one document to have five fields and the other document to have seven fields. Inside the function, we check if the population of the each element in the array is greater than 3 million. indexOf() or Array. MONGODB & PYTHON. Instead, you need to use "OrderItems. update() command in MongoDB In this Tutorial we will. Example: Array with documents : offices : [ {code: “col”}, {code: “usa”} ] We can use office. For (int num : array ) Here int is data type for num variable where you want to store all arrays data in otherwords you can say the destination where you want to give all component of arrays. Double-click on any value or array element to edit. Acts as a placeholder to update the first element that matches the query condition. @prafful-panwar I don't think looping is the right solution. It refers to the first matching element in the array. To compute the number of elements in a multidimensional array, multiply the number of elements in each index. Home » Java » update nested object inside an array MongoDB using Java driver update nested object inside an array MongoDB using Java driver Posted by: admin October 26, 2018 Leave a comment. So it will run only inside of the document. You have learned so far that you can easily query and add values into an array; using the same appraoch you can also remove entry in an array. Here in the above example the all the elements greater than equal to 85 in the array achieve have removed for any instance of "gkn" in the array subjects. The examples on this page use the inventory collection. Mathias Unfortunately this is not possible to do this directly with the $ positional operator since it only updates the first matching element of the array. but it is not working how to achieve this scenario. An ArrayBuffer is a mutable sequence, so you can delete elements with the usual -=, --=, remove, and clear methods. Step 1) Create a JavaScript variable called myEmployee to hold the array of documents. Ask Question Searching for array elements nested in MongoDB Documents. In the previous part of this series we looked at write concerns, write acknowledgements and replacing documents with the Save method. We need to protect our form data. Save array[i] in a scoped variable by creating a function. A field is a key-value pair. Hey guys, for class we're supposed to create a program to manipulate the elements of the array. In this blog, I'll talk about how to update existing documents in MongoDB with Monk. Based on my test , It seems that Azure Cosmos DB: MongoDB API does not support Array Update now, this feature will be supported in future. For (int num : array ) Here int is data type for num variable where you want to store all arrays data in otherwords you can say the destination where you want to give all component of arrays. A jagged array is sometimes called an "array of arrays. Likewise i want to insert the sample array element in MongoDB. 6+ and will result in an exception at. This worked to a point, exactly one level (Account) but my encoding failed to reach down to the Address arrays embedded within. There is already $ operator available in mongo but how we can use in this library. To step into this array-valued column, just right-click on the field and select Step Into Column. The DayHour variable, declared above, sets aside 168 (7*24) elements, in 7 rows and 24 columns. We provide a "template" as a high-level abstraction for storing and querying documents. js Mongoose is a JavaScript framework that is commonly used in a Node. Try this instead:. reactivestreams. See also the findIndex() method, which returns the index of a found element in the array instead of its value. To query if the array field contains at least one element with the specified value, use the filter {: } where is the element value. 6, when updating an array field, you can specify arrayFilters that determine which array elements to update. 4 (15 ratings) Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately. The following returns the same results as above: db. An empty array [] is treated as a missing field — a field with no values. The examples on this page use the inventory collection. Either one of them must be a scalar value. (AZURE cosmosDB/mongoDB) Update fields of an specific element of an object in an array. BSON originated in 2009 at MongoDB. Description. Under the hood, react-native-local-mongodb's persistence uses an append-only format, meaning that all updates and deletes actually result in lines added at the end of the string in AsyncStorage, for performance reasons. only specific field inside the json element embedded in the array you can do. This generated update contains a highlighted section that contains all the breaking changes that have been extracted from the commits. MongoDB – group, count and sort example By mkyong | May 3, 2016 | Viewed : 89,318 | +661 pv/w Some MongoDB examples to show you how to perform group by, count and sort query. This solution works well. Under the hood, react-native-local-mongodb's persistence uses an append-only format, meaning that all updates and deletes actually result in lines added at the end of the string in AsyncStorage, for performance reasons. ini file inside. I've noticed that the documentation at https://docs. An array is a set of values, which are termed elements, that are logically related to each other. Explicitly included jobs inherit the first value in the array # The jobs which are explicitly included inherit the first value of the expansion keys defined. In array_to_string, if the null-string parameter is omitted or NULL, any null elements in the array are simply skipped and not represented in the output string. If both keys/indexes has its value as an array, then it gets complicated. Taking a look at MongoDB 3. Graph stores are used to store information about networks of data, such as social connections. Array update operators: $: Acts as a placeholder to update the first element in an array for documents that matches the query condition. update() command in MongoDB In this Tutorial we will. Again, any valid BSON type can be used as the values, and the values in an array do not need to be of the same type. Hi Mateo, Direct query the last item in an array is currently not supported in MongoDB. a[0] = 45, so we have to move elements one step below so after insertion a[1] = 1 which was a[0] initially, and a[2] = 2 and a[3] = 3. So it will run only inside of the document. 6, Use positional operator to update all items in an array; array mongodb. FEATURE DESCRIPTION MongoDB 3. React Development Tools is a Chrome plugin that provides handy ways to inspect and debug your React components. TokuMX can probably handle 100-element indexed arrays fine, 1000 might be alright, 10000 is probably pushing it, but again, it’s just a multiplicative factor on top of your application’s throughput so YMMV. In this case, each element in the array will have a separate node in the BTree. Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java and XML. 2 you can also do this using the $ projection operator, where the $ in a projection object field name represents the index of the field's first matching array element from the query. In this article you will learn how to use ZappySys MongoDB Destination Connector to perform various bulk operations on MongoDB such as Insert, Update, Delete and Upsert. The type of the array can be an inbuilt type, a user-defined type or an enumerated type. You could then sort the base array by either name or salary by sorting on the appropriate overlay array. Retrieve only the queried element in an object array in MongoDB collection ; How to Update Multiple Array Elements in mongodb ; MongoDB: How to change the type of a field? How to check if an array field contains a unique value or another array in MongoDB?. js) you need to work with array's inside in MongoDB document and // find by document id and update. Nothing happen, but If I use 0 instead of $, the (wrong) element on array is changed – Dherik Mar 7 '18 at 17:07 @Dherik Do you have a question already with the details for your problem? If not can you create one with a sample document and your desired result? – chridam Mar 7 '18 at 17:32. js or Express. 0 Preview 4 is now available and it includes a bunch of new updates to ASP. To remove a field from all documents, set {multi: true}, else only the field of the first matched document will be removed. But the Update part I don't know how to reference a document inside an array and tell it to update one of it's variables with a new value. This generated update contains a highlighted section that contains all the breaking changes that have been extracted from the commits. update or change the field 'number' and 'updated_at' in a JSON element of 'alpha' array Not all of MongoDB's query syntax / capabilities are implemented in Azure Cosmos DB: MongoDB API. Updating element in array inside document with MongoDB not preserving its type Then it comes to a point where we need to update a single element in the mapObjects. MongoDB Query: Select and Filter Child Array By Brij Mohan If you are using embedded document to model one to many relationships in MongoDB , sometimes you might need to get child data only depends on the report. 0 will allow transactions to run in a replica set and, in a future release, the MongoDB transaction will work for sharded clusters. How to retrieve element present inside array in Mongo DB? which will allow. Type Parameters: E - the list element type. Save array[i] in a scoped variable by creating a function. Remove the fi rst element f om the ar ay a. Requires MongoDB 3. @prafful-panwar I don't think looping is the right solution. Originally published in the A Drip of JavaScript newsletter. A jagged array is an array whose elements are arrays. Embedded object fields in an array. Here's a simple pipeline to add up each Nth element from each array: db. In order to fully utilize the power of a document-based database like MongoDB, many people model their one-to-many relationships with embedded documents. This worked to a point, exactly one level (Account) but my encoding failed to reach down to the Address arrays embedded within. Introduction. Most guidelines I've found say that 10 elements in a MongoDB array might be ok, 100 is probably too much. Program to interchange the Small and Capital Letters.