Giter VIP home page Giter VIP logo

Comments (10)

mrsarm avatar mrsarm commented on September 21, 2024

The version from Docker is 2.0.2 while the latest version is 2.2.0, I have to update the MongoDB version in Docker but I can't now, and since 2.0.2 I added support to many types of registries, could you install the latest Mongotail version with pip in your system?

If you cannot install it globally with sudo you can install it in the Python user install directory with:

$ pip install --user mongotail

The problem with it is that the command mongotail will be placed at ~/.local/bin/mongotail, so you have to append the ~/.local/bin directory to your $PATH environment variable, or execute Mongotail with the full path in the command line.

from mongotail.

im-zhangxi avatar im-zhangxi commented on September 21, 2024

Now he made no mistake.

execute

db.getCollection('shop').find({"user_id": ObjectId("5e8b0782e6c7600dd858e3f6")}).limit(2)

mongotail db -f output

2020-04-06 12:57:47.131 QUERY     [shop] : {"user_id": ObjectId("5e8b0782e6c7600dd858e3f6")}. 2 returned.

It's not what I want.

I didn't see the limit message

from mongotail.

im-zhangxi avatar im-zhangxi commented on September 21, 2024

@mrsarm mongotail version

mongotail 2.3.0 <https://github.com/mrsarm/mongotail> (python 3.7.0)

mongodb version 4.1.13

from mongotail.

mrsarm avatar mrsarm commented on September 21, 2024

As much I remember the limit argument you pass is not recorded by the profiler at least in modern version of MongoDB. But lets be sure because there were some changes in the profiler format that then were roll-backed, please execute the same query but passing as limit another number like 999, and then execute mongotail in verbose mode like this mongotail db -v -f, and lets check whether the 999 is present in the output, if it's there, I can make a patch.

from mongotail.

im-zhangxi avatar im-zhangxi commented on September 21, 2024

When I execute the order : mongotail db -v -f

Request api , I get this result:

{"op": "query", "ns": "xx.shop", "command": {"find": "shop", "filter": {"user_id": ObjectId("5e8b0782e6c7600dd858e3f6"), "status": 1}, "sort": {"created_at": -1}, "projection": {"updated_at": 0, "deleted_at": 0}, "skip": 6, "limit": 2, "batchSize": 2, "$db": "xx"}, "keysExamined": 7, "docsExamined": 7, "hasSortStage": true, "cursorExhausted": true, "numYield": 0, "nreturned": 1, "queryHash": "E9D3CA53", "planCacheKey": "05B3EA84", "locks": {"ReplicationStateTransition": {"acquireCount": {"w": 1}}, "Global": {"acquireCount": {"r": 1}}, "Database": {"acquireCount": {"r": 1}}, "Collection": {"acquireCount": {"r": 1}}, "Mutex": {"acquireCount": {"r": 1}}}, "flowControl": {}, "responseLength": 267, "protocol": "op_query", "millis": 0, "planSummary": "IXSCAN { user_id: 1 }", "execStats": {"stage": "PROJECTION_DEFAULT", "nReturned": 1, "executionTimeMillisEstimate": 0, "works": 17, "advanced": 1, "needTime": 15, "needYield": 0, "saveState": 0, "restoreState": 0, "isEOF": 1, "transformBy": {
{"op": "command", "ns": "xx.shop", "command": {"count": "shop", "query": {"user_id": ObjectId("5e8b0782e6c7600dd858e3f6"), "status": 1}, "$db": "xx"}, "keysExamined": 7, "docsExamined": 7, "numYield": 0, "queryHash": "08C653AC", "planCacheKey": "AFF8AF5F", "locks": {"ReplicationStateTransition": {"acquireCount": {"w": 1}}, "Global": {"acquireCount": {"r": 1}}, "Database": {"acquireCount": {"r": 1}}, "Collection": {"acquireCount": {"r": 1}}, "Mutex": {"acquireCount": {"r": 1}}}, "flowControl": {}, "responseLength": 60, "protocol": "op_query", "millis": 0, "planSummary": "IXSCAN { user_id: 1 }", "execStats": {"stage": "COUNT", "nReturned": 0, "executionTimeMillisEstimate": 0, "works": 8, "advanced": 0, "needTime": 7, "needYield": 0, "saveState": 0, "restoreState": 0, "isEOF": 1, "nCounted": 7, "nSkipped": 0, "inputStage": {"stage": "FETCH", "filter": {"status": {"$eq": 1}}, "nReturned": 7, "executionTimeMillisEstimate": 0, "works": 8, "advanced": 7, "needTime": 0, "needYield": 0, "saveState": 0, "restoreState": 0, "isEOF": 1, "docsExamined": 7, "alreadyHasObj": 0, "inputStage": {"stage": "IXSCAN", "nReturned": 7, "executionTimeMillisEstimate": 0, "works": 8, "advanced": 7, "needTime": 0, "needYield": 0, "saveState": 0, "restoreState": 0, "isEOF": 1, "keyPattern": {"user_id": 1}, "indexName": "idx_user_id", "isMultiKey": false, "multiKeyPaths": {"user_id": []}, "isUnique": false, "isSparse": false, "isPartial": false, "indexVersion": 2, "direction": "forward", "indexBounds": {"user_id": ["[ObjectId("'5e8b0782e6c7600dd858e3f6'), ObjectId("'5e8b0782e6c7600dd858e3f6')]"]}, "keysExamined": 7, "seeks": 1, "dupsTested": 0, "dupsDropped": 0}}}, "ts": ISODate("2020-04-07T02:03:57.720Z"), "client": "0.0.0.0", "allUsers": [{"user": "admin", "db": "admin"}], "user": "admin@admin"}

Use Robo 3T 1.3.1, How do I implement that?

from mongotail.

mrsarm avatar mrsarm commented on September 21, 2024

OK, I could reproduce the what you say, checking the code ...

from mongotail.

mrsarm avatar mrsarm commented on September 21, 2024

Surprisingly mongotail currently does not support the pagination params limit and skip, I think the reason is because this information was not available in Mongo < 3.2, since 3.2 the format changed a lot, and these values are stored, so I added in this branch support for both arguments.

Try upgrade to the beta release of the branch with:

$ pip install --upgrade https://github.com/mrsarm/mongotail/archive/imp-mongo-pagination.zip

Change pip by pip3 if you have previously installed it with Python 3, and prepend to the command sudo if you are installing it globally.

Try and let me know the result, now executing this (also used skip):

db.getCollection('shop').find({"user_id": ObjectId("5e8b0782e6c7600dd858e3f6")}).limit(2).skip(10)

You get something like this:

2020-04-07 19:19:34.485 QUERY     [shop] : {"user_id": ObjectId("5e8b0782e6c7600dd858e3f6")}, limit: 2, skip: 10. 0 returned.

from mongotail.

im-zhangxi avatar im-zhangxi commented on September 21, 2024

I carried out the order:

pip install --upgrade https://github.com/mrsarm/mongotail/archive/imp-mongo-pagination.zip

Robo 3T executes the command:

db.getCollection('shop').find({"user_id": ObjectId("5e8b0782e6c7600dd858e3f6")}).limit(1).skip(1)

For db -v -f get:

{"op": "query", "ns": "merchant.shop", "command": {"find": "shop", "filter": {"user_id": ObjectId("5e8b0782e6c7600dd858e3f6")}, "skip": 1.0, "limit": 1.0, "singleBatch": false, "lsid": {"id": UUID("0fdc024d-bf86-4e8e-aaca-a34c28619ea6")}, "$readPreference": {"mode": "secondaryPreferred"}, "$db": "merchant"}, "keysExamined": 2, "docsExamined": 1, "cursorExhausted": true, "numYield": 0, "nreturned": 1, "queryHash": "D6EECA37", "planCacheKey": "4C856ECA", "locks": {"ReplicationStateTransition": {"acquireCount": {"w": 1}}, "Global": {"acquireCount": {"r": 1}}, "Database": {"acquireCount": {"r": 1}}, "Collection": {"acquireCount": {"r": 1}}, "Mutex": {"acquireCount": {"r": 1}}}, "flowControl": {}, "responseLength": 289, "protocol": "op_msg", "millis": 0, "planSummary": "IXSCAN { user_id: 1 }", "execStats": {"stage": "LIMIT", "nReturned": 1, "executionTimeMillisEstimate": 0, "works": 3, "advanced": 1, "needTime": 1, "needYield": 0, "saveState": 0, "restoreState": 0, "isEOF": 1, "limitAmount": 1, "inputStage": {"stage": "FETCH", "nReturned": 1, "executionTimeMillisEstimate": 0, "works": 2, "advanced": 1, "needTime": 1, "needYield": 0, "saveState": 0, "restoreState": 0, "isEOF": 0, "docsExamined": 1, "alreadyHasObj": 0, "inputStage": {"stage": "SKIP", "nReturned": 1, "executionTimeMillisEstimate": 0, "works": 2, "advanced": 1, "needTime": 1, "needYield": 0, "saveState": 0, "restoreState": 0, "isEOF": 0, "skipAmount": 0, "inputStage": {"stage": "IXSCAN", "nReturned": 2, "executionTimeMillisEstimate": 0, "works": 2, "advanced": 2, "needTime": 0, "needYield": 0, "saveState": 0, "restoreState": 0, "isEOF": 0, "keyPattern": {"user_id": 1}, "indexName": "idx_user_id", "isMultiKey": false, "multiKeyPaths": {"user_id": []}, "isUnique": false, "isSparse": false, "isPartial": false, "indexVersion": 2, "direction": "forward", "indexBounds": {"user_id": ["[ObjectId("'5e8b0782e6c7600dd858e3f6'), ObjectId("'5e8b0782e6c7600dd858e3f6')]"]}, "keysExamined": 2, "seeks": 1, "dupsTested": 0, "dupsDropped": 0}}}}, "ts": ISODate("2020-04-08T05:44:09.435Z"), "client": "0.0.0.0", "appName": "MongoDB Shell", "allUsers": [{"user": "root", "db": "merchant"}], "user": "root@merchant"}

For db -f get:

2020-04-08 05:44:22.298 QUERY     [shop] : {"user_id": ObjectId("5e8b0782e6c7600dd858e3f6")}, limit: 1, skip: 1. 1 returned.

Thanks

from mongotail.

mrsarm avatar mrsarm commented on September 21, 2024

Thanks @im-zhangxi !

I'm going to merge the patch tomorrow and release Mongotail 2.4.0 with this feature.

from mongotail.

mrsarm avatar mrsarm commented on September 21, 2024

Version with the fix released:

from mongotail.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.