Sponsored Content
Operating Systems Solaris Help with Reviving a NETRA240 Pls? Post 303026798 by hicksd8 on Monday 3rd of December 2018 12:17:06 PM
Old 12-03-2018
Yes, that is progress indeed. Well done!

I was lucky. At age 62 my treatment was a single coronary stent and selling my group of companies to reduce the stress. I'm now 68.
This User Gave Thanks to hicksd8 For This Post:
 

10 More Discussions You Might Find Interesting

1. Linux

pls help me

we hv a big enviroment networked. we use squid proxy. access allowed by src address previously. we have win2000 network with ads. my requirement is the proxy should allow domain users only for access. how can i map my windows userdatabase with squid is there any thing specific which has 2 b... (1 Reply)
Discussion started by: sriram.s
1 Replies

2. UNIX for Dummies Questions & Answers

Need help pls

Hi, I'm a newbie. I need help on my first assignment in UNIX. 1. How do I determine the number of non-empty directories? I was told to create a variable ARCHIVE, which points to the directory that contains the archive of the messages. But I'm so dumb and I don't even know how to do this. 2. In... (1 Reply)
Discussion started by: hygsg
1 Replies

3. UNIX for Dummies Questions & Answers

Pls Help

Hi every one I have got very very bad Email, My question is: How can I get all information about that f*** Email, I do mean IP,reall name, Adress, user name, password etc... I wonder if there is any program or website that I can see that email, help me please When I used windows Xp(old... (2 Replies)
Discussion started by: Cano
2 Replies

4. UNIX for Dummies Questions & Answers

Help pls!

Hi... Why should I press F1 to start windows?! I have Xp in my computer... thx 4 help Cano (1 Reply)
Discussion started by: Cano
1 Replies

5. Shell Programming and Scripting

pls help

I have a list of variables: ss1, ss5, ss6, ss8, st2 etc. (these values are not fixed, configurable). Now, I have assigned ss5=”test”. And I want to search in the list for the string “test” to know which variable is having the value “test”. Can u pls tell me how to do this? (10 Replies)
Discussion started by: kanchan_cp
10 Replies

6. Shell Programming and Scripting

pls help

Hi, I need your help guys. I have two data files, namely 101.amberized.pdb & 101.pdb . Now I want to replace the whole 3rd column of 101.amberized.pdb with the 3rd column of 101.pdb file. How do I do it in shell? Thanks in advance Parimal (11 Replies)
Discussion started by: chuchu
11 Replies

7. Shell Programming and Scripting

Pls Pls do help me

When i run this command, everything is ok. The file can be email and attached but soon after i download the file, the file cant be read. It's seem corrupted. Totally cant be read although i'm using context or wordfile. Original file generated at ek_bkup/alert/tbspace_datafile.log is OK..... ... (7 Replies)
Discussion started by: adzuanamir
7 Replies

8. UNIX for Dummies Questions & Answers

HELP PLs

I have this code: #!/bin/sh awk 'BEGIN NR == 2 repl = "PHI" $4 = repl print $0 'dryloop.txt and this code: #!/bin/sh sed -e '1s/\|$/\|COMID\|/g' -e 's/^087.*$/&PHI\|g' hl.dsldryloop > textdry.txt My code won't work. I want to change the COMID of lines starting with 087 . this is my... (15 Replies)
Discussion started by: arkhei
15 Replies

9. Homework & Coursework Questions

Help pls

How to find the ten most common words in a file (1 Reply)
Discussion started by: jass
1 Replies

10. Solaris

NETRA240 in HLR CDMA Wireless Exchange... help is apreciated

Greetings, I hope my post finds you all OK, I have a Netra240 server in an HLR inside a wireless CDMA Exchange, it works as a Hard Disk Unit (HDU) as shown in Local Management Terminal (LMT) as show in the picture 1 attached. The power went down because of a power failure in main UPS, when... (2 Replies)
Discussion started by: Sharista
2 Replies
MongoDB::Examples(3pm)					User Contributed Perl Documentation				    MongoDB::Examples(3pm)

NAME
MongoDB::Examples - Some examples of MongoDB syntax MAPPING SQL TO MONGODB
For developers familiar with SQL, the following chart should help you see how many common SQL queries could be expressed in MongoDB. These are Perl-specific examples of translating SQL queries to MongoDB's query language. To see the JavaScript (or other languages') mappings, see <http://dochub.mongodb.org/core/sqlToMongo>. "CREATE TABLE USERS (a Number, b Number)" Implicit, can be done explicitly. "INSERT INTO USERS VALUES(1,1)" $db->users->insert({a => 1, b => 1}); "SELECT a,b FROM users" $db->users->find({}, {a => 1, b => 1}); "SELECT * FROM users" $db->users->find; "SELECT * FROM users WHERE age=33" $db->users->find({age => 33}) "SELECT a,b FROM users WHERE age=33" $db->users->find({age => 33}, {a => 1, b => 1}); "SELECT * FROM users WHERE age=33 ORDER BY name" $db->users->find({age => 33})->sort({name => 1}); "<SELECT * FROM users WHERE age"33>> $db->users->find({age => {'$gt' => 33}}) "<SELECT * FROM users WHERE age<33"> $db->users->find({age => {'$lt' => 33}}) "SELECT * FROM users WHERE name LIKE "%Joe%"" $db->users->find({name => qr/Joe/}); "SELECT * FROM users WHERE name LIKE "Joe%"" $db->users->find({name => qr/^Joe/}); "<SELECT * FROM users WHERE age"33 AND age<=40>> $db->users->find({age => {'$gt' => 33, '$lte' => 40}}); "SELECT * FROM users ORDER BY name DESC" $db->users->find->sort({name => -1}); "CREATE INDEX myindexname ON users(name)" $db->users->ensure_index({name => 1}); "CREATE INDEX myindexname ON users(name,ts DESC)" $db->users->ensure_index(Tie::IxHash->new(name => 1, ts => -1)); "SELECT * FROM users WHERE a=1 and b='q'" $db->users->find({a => 1, b => "q"}); "SELECT * FROM users LIMIT 10 SKIP 20" $db->users->find->limit(10)->skip(20); "SELECT * FROM users WHERE a=1 or b=2" $db->users->find({'$or' => [{a => 1}, {b => 2}]}); "SELECT * FROM users LIMIT 1" $db->users->find->limit(1); "EXPLAIN SELECT * FROM users WHERE z=3" $db->users->find({z => 3})->explain; "SELECT DISTINCT last_name FROM users" $db->run_command({distinct => "users", key => "last_name"}); "SELECT COUNT(*y) FROM users" $db->users->count; "<SELECT COUNT(*y) FROM users where age " 30>> $db->users->find({"age" => {'$gt' => 30}})->count; "SELECT COUNT(age) from users" $db->users->find({age => {'$exists' => 1}})->count; "UPDATE users SET a=1 WHERE b='q'" $db->users->update({b => "q"}, {'$set' => {a => 1}}); "UPDATE users SET a=a+2 WHERE b='q'" $db->users->update({b => "q"}, {'$inc' => {a => 2}}); "DELETE FROM users WHERE z="abc"" $db->users->remove({z => "abc"}); DATABASE COMMANDS
Distinct The distinct command returns all values for a given key in a collection. For example, suppose we had a collection with the following documents ("_id" value ignored): { 'name' => 'a', code => 1 } { 'name' => 'b', code => 1 } { 'name' => 'c', code => 2 } { 'name' => 'd', code => "3" } If we wanted to see all of values in the "code" field, we could run: my $result = $db->run_command([ "distinct" => "collection_name", "key" => "code", "query" => {} ]); Notice that the arguments are in an array, to ensure that their order is preserved. You could also use a Tie::IxHash. "query" is an optional argument, which can be used to only run "distinct" on specific documents. It takes a hash (or Tie::IxHash or array) in the same form as "find($query)" in MongoDB::Collection. Running "distinct" on the above collection would give you: { 'ok' => '1', 'values' => [ 1, 2, "3" ] }; Find-and-modify The find-and-modify command is similar to update (or remove), but it will return the modified document. It can be useful for implementing queues or locks. For example, suppose we had a list of things to do, and we wanted to remove the highest-priority item for processing. We could do a "find" in MongoDB::Collection and then a "remove" in MongoDB::Collection, but that wouldn't be atomic (a write could occur between the query and the remove). Instead, we can use find and modify. my $next_task = $db->run_command({ findAndModify => "todo", sort => {priority => -1}, remove => 1 }); This will atomically find and pop the next-highest-priority task. See <http://www.mongodb.org/display/DOCS/findAndModify+Command> for more details on find-and-modify. Group The group command is similar to "GROUP BY" in SQL. You can use the "run_command" in MongoDB::Database method to perform group-bys with MongoDB. For example, suppose we have a number of local businesses stored in a "business" collection. If we wanted to find the number of coffeeshops in each neighborhood, we could do: my $reduce = <<REDUCE; function(doc, prev) { for (var t in doc.tags) { if (doc.tags[t] == "coffeeshop") { prev["num coffeeshops"]++; break; } } } REDUCE my $result = $db->run_command({group => { 'ns' => "business", 'key' => {"neighborhood" => 1}, 'initial' => {"num coffeeshops" => 0}, '$reduce' => MongoDB::Code->new(code => $reduce) This would return something like: { 'ok' => '1', 'keys' => 4, 'count' => '487', # total number of documents 'retval' => [ { 'neighborhood' => 'Soho', 'num coffeeshops' => '23' }, { 'neighborhood' => 'Chinatown', 'num coffeeshops' => '14' }, { 'neighborhood' => 'Upper East Side', 'num coffeeshops' => '10' }, { 'neighborhood' => 'East Village', 'num coffeeshops' => '87' } ] }; Thus, there are 23 coffeeshops in Soho, 14 in Chinatown, and so on. See <http://www.mongodb.org/display/DOCS/Aggregation> for more details on grouping. MapReduce MapReduce is a powerful aggregation tool. (For traditional queries, you should use "MongoDB::Collection::query".) This example counts the number of occurences of each tag in a collection. Each document contains a "tags" array that contains zero or more strings. my $map = <<MAP; function() { this.tags.forEach(function(tag) { emit(tag, {count : 1}); }); } MAP my $reduce = <<REDUCE; function(prev, current) { result = {count : 0}; current.forEach(function(item) { result.count += item.count; }); return result; } REDUCE my $cmd = Tie::IxHash->new("mapreduce" => "foo", "map" => $map, "reduce" => $reduce); my $result = $db->run_command($cmd); See the MongoDB documentation on MapReduce for more information (<http://dochub.mongodb.org/core/mapreduce>). UPDATING
Positional Operator In MongoDB 1.3.4 and later, you can use positional operator, "$", to update elements of an array. For instance, suppose you have an array of user information and you want to update a user's name. A sample document in JavaScript: { "users" : [ { "name" : "bill", "age" : 60 }, { "name" : "fred", "age" : 29 }, ] } The update: $coll->update({"users.name" => "fred"}, {'users.$.name' => "george"}); This will update the array so that the element containing "name" => "fred" now has "name" => "george". perl v5.14.2 2011-08-29 MongoDB::Examples(3pm)
All times are GMT -4. The time now is 03:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy